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 <smb-apa...@alcyon.net<mailto:smb-apa...@alcyon.net>>
Reply-To: "solr-user@lucene.apache.org<mailto:solr-user@lucene.apache.org>" 
<solr-user@lucene.apache.org<mailto:solr-user@lucene.apache.org>>
Date: Monday, March 10, 2014 at 4:23 PM
To: "solr-user@lucene.apache.org<mailto:solr-user@lucene.apache.org>" 
<solr-user@lucene.apache.org<mailto:solr-user@lucene.apache.org>>
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 
<smb-apa...@alcyon.net<mailto:smb-apa...@alcyon.net>> 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 via email to