[
https://issues.apache.org/jira/browse/SOLR-4947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13691157#comment-13691157
]
David Smiley commented on SOLR-4947:
------------------------------------
Glad to be of help, Christian.
I thought the problem was precision but, no, that was not it. Your polygon is
a rectangle, and such polygons must follow the counter-clockwise order rule.
The WKT spec says this is how it needs to be, although apparently most software
out there appears to work by allowing either order and limiting rects to < 180
degrees. Spatial4j follows the spec but in its next release I plan to have it
not do this so that it is more compatible. This is a very common issue people
hit and [it's in the
FAQ|http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4#JTS_.2F_WKT_.2F_Polygon_notes]
(see "Common Error").
Because it was in the wrong order, the rectangle loops the other way around the
world, and because it's now a bigger shape than intended it's also gridded to
larger grid cells.
To see what the problem was, I brought up the [spatial solr sandbox (spatial
demo)|https://github.com/ryantxu/spatial-solr-sandbox] and had it plot your
polygon in Google Earth. You can watch me do this as part of a [bigger
presentation|http://www.youtube.com/watch?v=L2cUGv0Rebs] on spatial I did at
Lucene Revolution.
> geofilt gives wrong results
> ---------------------------
>
> Key: SOLR-4947
> URL: https://issues.apache.org/jira/browse/SOLR-4947
> Project: Solr
> Issue Type: Bug
> Components: spatial
> Affects Versions: 4.3
> Environment: java version "1.7.0_15"
> OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.04.1)
> OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
> Reporter: Christian Winkler
> Assignee: David Smiley
> Priority: Critical
>
> I have indexed (filtered) OpenStreetMap data for Germany including ways,
> total 3,855,159 documents, core is optimized.
> Queries contain some correct results but also (seemingly) arbitrary others:
> {noformat}
> <lst name="responseHeader">
> <int name="status">0</int>
> <int name="QTime">335</int>
> <lst name="params">
> <str name="indent">true</str>
> <str name="q">{!geofilt sfield=geo pt=49.434825,11.079835 d=1} </str>
> <str name="_">1371806261508</str>
> <str name="wt">xml</str>
> </lst>
> </lst>
> <result name="response" numFound="823" start="0">
> <doc>
> <str name="id">w55380630</str>
> <str name="geo">POLYGON((7.342515 49.3058912, 7.3428923 49.3058912,
> 7.3428923 49.3057308, 7.342515 49.3057308, 7.342515 49.3058912)
> )</str>
> <str name="amenity">place_of_worship</str>
> <str name="name">Klinikkirche</str>
> <long name="_version_">1438312839527792640</long></doc>
> <doc>
> <str name="id">w77731561</str>
> <str name="geo">POLYGON((7.7563699 50.4972286, 7.7563699 50.4972296,
> 7.7563713 50.4972296, 7.7563713 50.4972286, 7.7563699 50.4972286)
> )</str>
> [...]
> {noformat}
> 7.7° is not within 1km of 11.1°. It only happens with shapes.
> Indexing only a part of Germany the query works fine and produces the correct
> results.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]