Issue with spatial search

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with spatial search

Steven Bower
I am seeing a "error" when doing a spatial search where a particular point is showing up within a polygon, but by all methods I've tried that point is not within the polygon..

First the point is: 41.2299,29.1345 (lat/lon)

The polygon is:

31.2719,32.283
31.2179,32.3681
31.1333,32.3407
30.9356,32.6318
31.0707,34.5196
35.2053,36.9415
37.2959,36.6339
40.8334,30.4273
41.1622,29.1421
41.6484,27.4832
47.0255,13.6342
43.9457,3.17525
37.0029,-5.7017
35.7741,-5.57719
34.801,-4.66201
33.345,10.0157
29.6745,18.9366
30.6592,29.1683
31.2719,32.283

The geo field we are using has this config:

<fieldType name="location_rpt"
           class="solr.SpatialRecursivePrefixTreeFieldType" 
           distErrPct="0.025" 
           maxDistErr="0.000009"              
           spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
           units="degrees"/>

The config is basically the same as the one from the docs...

They query I am issuing is this:

location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"

and it brings back a result where the "location" field is 41.2299,29.1345

I've attached a KML with the polygon and the point and you can see from that, visually, that the point is not within the polygon. I also tried in google maps API but after playing around realize that the polygons in maps are draw in Euclidian space while the map itself is a Mercator projection.. Loading the kml in earth fixes this issue but the point still lays outside the polygon.. The distance between the edge of the polygon closes to the point and the point itself is ~1.2 miles which is much larger than the 1meter accuracy given by the maxDistErr (per the docs).

Any thoughts on this?

Thanks,

Steve

solr_map_issue.kml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

Steven Bower
Minor edit to the KML to adjust color of polygon


On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower <[hidden email]> wrote:
I am seeing a "error" when doing a spatial search where a particular point is showing up within a polygon, but by all methods I've tried that point is not within the polygon..

First the point is: 41.2299,29.1345 (lat/lon)

The polygon is:

31.2719,32.283
31.2179,32.3681
31.1333,32.3407
30.9356,32.6318
31.0707,34.5196
35.2053,36.9415
37.2959,36.6339
40.8334,30.4273
41.1622,29.1421
41.6484,27.4832
47.0255,13.6342
43.9457,3.17525
37.0029,-5.7017
35.7741,-5.57719
34.801,-4.66201
33.345,10.0157
29.6745,18.9366
30.6592,29.1683
31.2719,32.283

The geo field we are using has this config:

<fieldType name="location_rpt"
           class="solr.SpatialRecursivePrefixTreeFieldType" 
           distErrPct="0.025" 
           maxDistErr="0.000009"              
           spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
           units="degrees"/>

The config is basically the same as the one from the docs...

They query I am issuing is this:

location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"

and it brings back a result where the "location" field is 41.2299,29.1345

I've attached a KML with the polygon and the point and you can see from that, visually, that the point is not within the polygon. I also tried in google maps API but after playing around realize that the polygons in maps are draw in Euclidian space while the map itself is a Mercator projection.. Loading the kml in earth fixes this issue but the point still lays outside the polygon.. The distance between the edge of the polygon closes to the point and the point itself is ~1.2 miles which is much larger than the 1meter accuracy given by the maxDistErr (per the docs).

Any thoughts on this?

Thanks,

Steve


solr_map_issue.kml (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

Steven Bower
Weirdly that same point shows up in the polygon below as well, which in the
area around the point doesn't intersect with the polygon in my first msg...

            29.0454,41.2198
            29.2349,41.1826
            31.1107,40.9956
            38.437,40.7991
            41.1616,40.8988
            42.1284,42.2141
            40.0919,47.8482
            30.4169,47.5783
            26.9892,43.6459
            27.2095,41.5676
            29.0454,41.2198



On Mon, Mar 10, 2014 at 4:23 PM, Steven Bower <[hidden email]> wrote:

> Minor edit to the KML to adjust color of polygon
>
>
> On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower <[hidden email]>wrote:
>
>> I am seeing a "error" when doing a spatial search where a particular
>> point is showing up within a polygon, but by all methods I've tried that
>> point is not within the polygon..
>>
>> First the point is: 41.2299,29.1345 (lat/lon)
>>
>> The polygon is:
>>
>> 31.2719,32.283
>> 31.2179,32.3681
>> 31.1333,32.3407
>> 30.9356,32.6318
>> 31.0707,34.5196
>> 35.2053,36.9415
>> 37.2959,36.6339
>> 40.8334,30.4273
>> 41.1622,29.1421
>> 41.6484,27.4832
>> 47.0255,13.6342
>> 43.9457,3.17525
>> 37.0029,-5.7017
>> 35.7741,-5.57719
>> 34.801,-4.66201
>> 33.345,10.0157
>> 29.6745,18.9366
>> 30.6592,29.1683
>> 31.2719,32.283
>>
>> The geo field we are using has this config:
>>
>> <fieldType name="location_rpt"
>>            class="solr.SpatialRecursivePrefixTreeFieldType"
>>            distErrPct="0.025"
>>            maxDistErr="0.000009"
>>
>>  spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
>>            units="degrees"/>
>>
>> The config is basically the same as the one from the docs...
>>
>> They query I am issuing is this:
>>
>> location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407
>> 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339
>> 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342
>> 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201
>> 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"
>>
>> and it brings back a result where the "location" field is 41.2299,29.1345
>>
>> I've attached a KML with the polygon and the point and you can see from
>> that, visually, that the point is not within the polygon. I also tried in
>> google maps API but after playing around realize that the polygons in maps
>> are draw in Euclidian space while the map itself is a Mercator projection..
>> Loading the kml in earth fixes this issue but the point still lays outside
>> the polygon.. The distance between the edge of the polygon closes to the
>> point and the point itself is ~1.2 miles which is much larger than the
>> 1meter accuracy given by the maxDistErr (per the docs).
>>
>> Any thoughts on this?
>>
>> Thanks,
>>
>> Steve
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

David Smiley
In reply to this post by Steven Bower
Hi Steven,

Set distErrPct to 0 in order to get non-point shapes to always be as accurate as maxDistErr.  Point shapes are always that accurate.  As long as you only index points, not other shapes (you don’t index polygons, etc.) then distErrPct of 0 should be fine.  In fact, perhaps a future Solr version should simply use 0 as the default; the last time I did benchmarks it was pretty marginal impact of higher distErrPct.

It’s a fairly different story if you are indexing non-point shapes.

~ David

From: Steven Bower <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Monday, March 10, 2014 at 4:23 PM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: Re: Issue with spatial search

Minor edit to the KML to adjust color of polygon


On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower <[hidden email]<mailto:[hidden email]>> wrote:
I am seeing a "error" when doing a spatial search where a particular point is showing up within a polygon, but by all methods I've tried that point is not within the polygon..

First the point is: 41.2299,29.1345 (lat/lon)

The polygon is:

31.2719,32.283
31.2179,32.3681
31.1333,32.3407
30.9356,32.6318
31.0707,34.5196
35.2053,36.9415
37.2959,36.6339
40.8334,30.4273
41.1622,29.1421
41.6484,27.4832
47.0255,13.6342
43.9457,3.17525
37.0029,-5.7017
35.7741,-5.57719
34.801,-4.66201
33.345,10.0157
29.6745,18.9366
30.6592,29.1683
31.2719,32.283

The geo field we are using has this config:

<fieldType name="location_rpt"
           class="solr.SpatialRecursivePrefixTreeFieldType"
           distErrPct="0.025"
           maxDistErr="0.000009"
           spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
           units="degrees"/>

The config is basically the same as the one from the docs...

They query I am issuing is this:

location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"

and it brings back a result where the "location" field is 41.2299,29.1345

I've attached a KML with the polygon and the point and you can see from that, visually, that the point is not within the polygon. I also tried in google maps API but after playing around realize that the polygons in maps are draw in Euclidian space while the map itself is a Mercator projection.. Loading the kml in earth fixes this issue but the point still lays outside the polygon.. The distance between the edge of the polygon closes to the point and the point itself is ~1.2 miles which is much larger than the 1meter accuracy given by the maxDistErr (per the docs).

Any thoughts on this?

Thanks,

Steve

Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

Steven Bower
Only points in the index.. Am I correct this won't require a reindex?

On Monday, March 10, 2014, Smiley, David W. <[hidden email]> wrote:

> Hi Steven,
>
> Set distErrPct to 0 in order to get non-point shapes to always be as
> accurate as maxDistErr.  Point shapes are always that accurate.  As long as
> you only index points, not other shapes (you don't index polygons, etc.)
> then distErrPct of 0 should be fine.  In fact, perhaps a future Solr
> version should simply use 0 as the default; the last time I did benchmarks
> it was pretty marginal impact of higher distErrPct.
>
> It's a fairly different story if you are indexing non-point shapes.
>
> ~ David
>
> From: Steven Bower <[hidden email] <javascript:;><mailto:
> [hidden email] <javascript:;>>>
> Reply-To: "[hidden email] <javascript:;><mailto:
> [hidden email] <javascript:;>>" <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>>
> Date: Monday, March 10, 2014 at 4:23 PM
> To: "[hidden email] <javascript:;><mailto:
> [hidden email] <javascript:;>>" <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>>
> Subject: Re: Issue with spatial search
>
> Minor edit to the KML to adjust color of polygon
>
>
> On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>> wrote:
> I am seeing a "error" when doing a spatial search where a particular point
> is showing up within a polygon, but by all methods I've tried that point is
> not within the polygon..
>
> First the point is: 41.2299,29.1345 (lat/lon)
>
> The polygon is:
>
> 31.2719,32.283
> 31.2179,32.3681
> 31.1333,32.3407
> 30.9356,32.6318
> 31.0707,34.5196
> 35.2053,36.9415
> 37.2959,36.6339
> 40.8334,30.4273
> 41.1622,29.1421
> 41.6484,27.4832
> 47.0255,13.6342
> 43.9457,3.17525
> 37.0029,-5.7017
> 35.7741,-5.57719
> 34.801,-4.66201
> 33.345,10.0157
> 29.6745,18.9366
> 30.6592,29.1683
> 31.2719,32.283
>
> The geo field we are using has this config:
>
> <fieldType name="location_rpt"
>            class="solr.SpatialRecursivePrefixTreeFieldType"
>            distErrPct="0.025"
>            maxDistErr="0.000009"
>
>  spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
>            units="degrees"/>
>
> The config is basically the same as the one from the docs...
>
> They query I am issuing is this:
>
> location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407
> 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339
> 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342
> 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201
> 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"
>
> and it brings back a result where the "location" field is 41.2299,29.1345
>
> I've attached a KML with the polygon and the point and you can see from
> that, visually, that the point is not within the polygon. I also tried in
> google maps API but after playing around realize that the polygons in maps
> are draw in Euclidian space while the map itself is a Mercator projection..
> Loading the kml in earth fixes this issue but the point still lays outside
> the polygon.. The distance between the edge of the polygon closes to the
> point and the point itself is ~1.2 miles which is much larger than the
> 1meter accuracy given by the maxDistErr (per the docs).
>
> Any thoughts on this?
>
> Thanks,
>
> Steve
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

David Smiley
Correct, Steve. Alternatively you can also put this option in your query after the end of the last parenthesis, as in this example from the wiki:

  fq=geo:"IsWithin(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"

~ David

Steven Bower wrote
Only points in the index.. Am I correct this won't require a reindex?

On Monday, March 10, 2014, Smiley, David W. <[hidden email]> wrote:

> Hi Steven,
>
> Set distErrPct to 0 in order to get non-point shapes to always be as
> accurate as maxDistErr.  Point shapes are always that accurate.  As long as
> you only index points, not other shapes (you don't index polygons, etc.)
> then distErrPct of 0 should be fine.  In fact, perhaps a future Solr
> version should simply use 0 as the default; the last time I did benchmarks
> it was pretty marginal impact of higher distErrPct.
>
> It's a fairly different story if you are indexing non-point shapes.
>
> ~ David
>
> From: Steven Bower <[hidden email] <javascript:;><mailto:
[hidden email] <javascript:;>>>
> Reply-To: "[hidden email] <javascript:;><mailto:
[hidden email] <javascript:;>>" <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>>
> Date: Monday, March 10, 2014 at 4:23 PM
> To: "[hidden email] <javascript:;><mailto:
[hidden email] <javascript:;>>" <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>>
> Subject: Re: Issue with spatial search
>
> Minor edit to the KML to adjust color of polygon
>
>
> On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower <[hidden email]<javascript:;>
> <mailto:[hidden email] <javascript:;>>> wrote:
> I am seeing a "error" when doing a spatial search where a particular point
> is showing up within a polygon, but by all methods I've tried that point is
> not within the polygon..
>
> First the point is: 41.2299,29.1345 (lat/lon)
>
> The polygon is:
>
> 31.2719,32.283
> 31.2179,32.3681
> 31.1333,32.3407
> 30.9356,32.6318
> 31.0707,34.5196
> 35.2053,36.9415
> 37.2959,36.6339
> 40.8334,30.4273
> 41.1622,29.1421
> 41.6484,27.4832
> 47.0255,13.6342
> 43.9457,3.17525
> 37.0029,-5.7017
> 35.7741,-5.57719
> 34.801,-4.66201
> 33.345,10.0157
> 29.6745,18.9366
> 30.6592,29.1683
> 31.2719,32.283
>
> The geo field we are using has this config:
>
> <fieldType name="location_rpt"
>            class="solr.SpatialRecursivePrefixTreeFieldType"
>            distErrPct="0.025"
>            maxDistErr="0.000009"
>
>  spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
>            units="degrees"/>
>
> The config is basically the same as the one from the docs...
>
> They query I am issuing is this:
>
> location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407
> 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339
> 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342
> 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201
> 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283 31.2719)))"
>
> and it brings back a result where the "location" field is 41.2299,29.1345
>
> I've attached a KML with the polygon and the point and you can see from
> that, visually, that the point is not within the polygon. I also tried in
> google maps API but after playing around realize that the polygons in maps
> are draw in Euclidian space while the map itself is a Mercator projection..
> Loading the kml in earth fixes this issue but the point still lays outside
> the polygon.. The distance between the edge of the polygon closes to the
> point and the point itself is ~1.2 miles which is much larger than the
> 1meter accuracy given by the maxDistErr (per the docs).
>
> Any thoughts on this?
>
> Thanks,
>
> Steve
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

Steven Bower-2
great.. that worked!

What does distErrPct actually control, besides controlling the error
percentage? or maybe better put how does it impact perf?

steve


On Mon, Mar 10, 2014 at 11:17 PM, David Smiley (@MITRE.org) <
[hidden email]> wrote:

> Correct, Steve. Alternatively you can also put this option in your query
> after the end of the last parenthesis, as in this example from the wiki:
>
>   fq=geo:"IsWithin(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))
> distErrPct=0"
>
> ~ David
>
>
> Steven Bower wrote
> > Only points in the index.. Am I correct this won't require a reindex?
> >
> > On Monday, March 10, 2014, Smiley, David W. &lt;
>
> > dsmiley@
>
> > &gt; wrote:
> >
> >> Hi Steven,
> >>
> >> Set distErrPct to 0 in order to get non-point shapes to always be as
> >> accurate as maxDistErr.  Point shapes are always that accurate.  As long
> >> as
> >> you only index points, not other shapes (you don't index polygons, etc.)
> >> then distErrPct of 0 should be fine.  In fact, perhaps a future Solr
> >> version should simply use 0 as the default; the last time I did
> >> benchmarks
> >> it was pretty marginal impact of higher distErrPct.
> >>
> >> It's a fairly different story if you are indexing non-point shapes.
> >>
> >> ~ David
> >>
> >> From: Steven Bower &lt;
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;>>
> >> Reply-To: "
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>" &lt;
>
> > solr-user@.apache
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>>
> >> Date: Monday, March 10, 2014 at 4:23 PM
> >> To: "
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>" &lt;
>
> > solr-user@.apache
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>>
> >> Subject: Re: Issue with spatial search
> >>
> >> Minor edit to the KML to adjust color of polygon
> >>
> >>
> >> On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower &lt;
>
> > smb-apache@
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;>> wrote:
> >> I am seeing a "error" when doing a spatial search where a particular
> >> point
> >> is showing up within a polygon, but by all methods I've tried that point
> >> is
> >> not within the polygon..
> >>
> >> First the point is: 41.2299,29.1345 (lat/lon)
> >>
> >> The polygon is:
> >>
> >> 31.2719,32.283
> >> 31.2179,32.3681
> >> 31.1333,32.3407
> >> 30.9356,32.6318
> >> 31.0707,34.5196
> >> 35.2053,36.9415
> >> 37.2959,36.6339
> >> 40.8334,30.4273
> >> 41.1622,29.1421
> >> 41.6484,27.4832
> >> 47.0255,13.6342
> >> 43.9457,3.17525
> >> 37.0029,-5.7017
> >> 35.7741,-5.57719
> >> 34.801,-4.66201
> >> 33.345,10.0157
> >> 29.6745,18.9366
> >> 30.6592,29.1683
> >> 31.2719,32.283
> >>
> >> The geo field we are using has this config:
> >>
> >>
> > <fieldType name="location_rpt"
> >>
> >             class="solr.SpatialRecursivePrefixTreeFieldType"
> >>            distErrPct="0.025"
> >>            maxDistErr="0.000009"
> >>
> >>
> >>
> spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
> >>            units="degrees"/>
> >>
> >> The config is basically the same as the one from the docs...
> >>
> >> They query I am issuing is this:
> >>
> >> location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407
> >> 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339
> >> 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342
> >> 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201
> >> 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283
> >> 31.2719)))"
> >>
> >> and it brings back a result where the "location" field is
> 41.2299,29.1345
> >>
> >> I've attached a KML with the polygon and the point and you can see from
> >> that, visually, that the point is not within the polygon. I also tried
> in
> >> google maps API but after playing around realize that the polygons in
> >> maps
> >> are draw in Euclidian space while the map itself is a Mercator
> >> projection..
> >> Loading the kml in earth fixes this issue but the point still lays
> >> outside
> >> the polygon.. The distance between the edge of the polygon closes to the
> >> point and the point itself is ~1.2 miles which is much larger than the
> >> 1meter accuracy given by the maxDistErr (per the docs).
> >>
> >> Any thoughts on this?
> >>
> >> Thanks,
> >>
> >> Steve
> >>
> >>
>
>
>
>
>
> -----
>  Author:
> http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Issue-with-spatial-search-tp4122690p4122744.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Issue with spatial search

David Smiley
It controls accuracy of non-point shapes.  The more accurate you want it, the more work Lucene must do to achieve it.  For query shapes, the impact is not much the last time I checked.  For indexed shapes (again, non-point shapes we’re talking about), however, it has an exponential curve trade-off where it’s increasingly painful to get close to distErrPct=0 if the shapes cover a large area.  I have near-term plans to address the index-time non-point shape accuracy but at least you don’t have that case from the scenario you gave.

~ David

From: "Steven Bower-2 [via Lucene]" <[hidden email]>
Date: Tuesday, March 11, 2014 at 9:45 AM
To: "Smiley, David W." <[hidden email]>
Subject: Re: Issue with spatial search

great.. that worked!

What does distErrPct actually control, besides controlling the error
percentage? or maybe better put how does it impact perf?

steve


On Mon, Mar 10, 2014 at 11:17 PM, David Smiley (@MITRE.org) <
[hidden email]> wrote:

> Correct, Steve. Alternatively you can also put this option in your query
> after the end of the last parenthesis, as in this example from the wiki:
>
>   fq=geo:"IsWithin(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))
> distErrPct=0"
>
> ~ David
>
>
> Steven Bower wrote
> > Only points in the index.. Am I correct this won't require a reindex?
> >
> > On Monday, March 10, 2014, Smiley, David W. &lt;
>
> > dsmiley@
>
> > &gt; wrote:
> >
> >> Hi Steven,
> >>
> >> Set distErrPct to 0 in order to get non-point shapes to always be as
> >> accurate as maxDistErr.  Point shapes are always that accurate.  As long
> >> as
> >> you only index points, not other shapes (you don't index polygons, etc.)
> >> then distErrPct of 0 should be fine.  In fact, perhaps a future Solr
> >> version should simply use 0 as the default; the last time I did
> >> benchmarks
> >> it was pretty marginal impact of higher distErrPct.
> >>
> >> It's a fairly different story if you are indexing non-point shapes.
> >>
> >> ~ David
> >>
> >> From: Steven Bower &lt;
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;>>
> >> Reply-To: "
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>" &lt;
>
> > solr-user@.apache
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>>
> >> Date: Monday, March 10, 2014 at 4:23 PM
> >> To: "
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;
> > <mailto:
> >>
> >
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>" &lt;
>
> > solr-user@.apache
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > solr-user@.apache
>
> >  &lt;javascript:;&gt;>>
> >> Subject: Re: Issue with spatial search
> >>
> >> Minor edit to the KML to adjust color of polygon
> >>
> >>
> >> On Mon, Mar 10, 2014 at 4:21 PM, Steven Bower &lt;
>
> > smb-apache@
>
> > &lt;javascript:;&gt;
> >> &lt;mailto:
>
> > smb-apache@
>
> >  &lt;javascript:;&gt;>> wrote:
> >> I am seeing a "error" when doing a spatial search where a particular
> >> point
> >> is showing up within a polygon, but by all methods I've tried that point
> >> is
> >> not within the polygon..
> >>
> >> First the point is: 41.2299,29.1345 (lat/lon)
> >>
> >> The polygon is:
> >>
> >> 31.2719,32.283
> >> 31.2179,32.3681
> >> 31.1333,32.3407
> >> 30.9356,32.6318
> >> 31.0707,34.5196
> >> 35.2053,36.9415
> >> 37.2959,36.6339
> >> 40.8334,30.4273
> >> 41.1622,29.1421
> >> 41.6484,27.4832
> >> 47.0255,13.6342
> >> 43.9457,3.17525
> >> 37.0029,-5.7017
> >> 35.7741,-5.57719
> >> 34.801,-4.66201
> >> 33.345,10.0157
> >> 29.6745,18.9366
> >> 30.6592,29.1683
> >> 31.2719,32.283
> >>
> >> The geo field we are using has this config:
> >>
> >>
> > <fieldType name="location_rpt"
> >>
> >             class="solr.SpatialRecursivePrefixTreeFieldType"
> >>            distErrPct="0.025"
> >>            maxDistErr="0.000009"
> >>
> >>
> >>
> spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
> >>            units="degrees"/>
> >>
> >> The config is basically the same as the one from the docs...
> >>
> >> They query I am issuing is this:
> >>
> >> location:"Intersects(POLYGON((32.283 31.2719, 32.3681 31.2179, 32.3407
> >> 31.1333, 32.6318 30.9356, 34.5196 31.0707, 36.9415 35.2053, 36.6339
> >> 37.2959, 30.4273 40.8334, 29.1421 41.1622, 27.4832 41.6484, 13.6342
> >> 47.0255, 3.17525 43.9457, -5.7017 37.0029, -5.57719 35.7741, -4.66201
> >> 34.801, 10.0157 33.345, 18.9366 29.6745, 29.1683 30.6592, 32.283
> >> 31.2719)))"
> >>
> >> and it brings back a result where the "location" field is
> 41.2299,29.1345
> >>
> >> I've attached a KML with the polygon and the point and you can see from
> >> that, visually, that the point is not within the polygon. I also tried
> in
> >> google maps API but after playing around realize that the polygons in
> >> maps
> >> are draw in Euclidian space while the map itself is a Mercator
> >> projection..
> >> Loading the kml in earth fixes this issue but the point still lays
> >> outside
> >> the polygon.. The distance between the edge of the polygon closes to the
> >> point and the point itself is ~1.2 miles which is much larger than the
> >> 1meter accuracy given by the maxDistErr (per the docs).
> >>
> >> Any thoughts on this?
> >>
> >> Thanks,
> >>
> >> Steve
> >>
> >>
>
>
>
>
>
> -----
>  Author:
> http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Issue-with-spatial-search-tp4122690p4122744.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



If you reply to this email, your message will be added to the discussion below:
http://lucene.472066.n3.nabble.com/Issue-with-spatial-search-tp4122690p4122855.html
To unsubscribe from Issue with spatial search, click here.
NAML