Hi,

I’m using Solr 4.10.2 with an up to date version of JTS and spatial4j. As
field type in my schema.xml i’m using “location_rpt” like the description
in the documentation. (
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4#How_to_Use)

location_rpt field type setup:

<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"

spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
         distErrPct="0.025"
         maxDistErr="0.001"
         units="degrees" />


<field name="latlon_rpt"  type="location_rpt"  indexed="true"
stored="true"  multiValued="true" />

My filter query like this :

latlon_rpt:"INTERSECTS (POLYGON((16.243972778320312 48.27016879304729,
16.411170959472656 48.268340583150504, 16.44275665283203 48.19058119922813,
16.32396697998047 48.15921534239267,16.243972778320312 48.27016879304729)))


Everything works fine. My problem is when i am trying to use a more complex
polygon (self-intersecting) Solr only shows an Error like this:

"Couldn't parse shape 'POLYGON((-87.525029 41.676998,-87.508635
41.680781,-87.494559 41.681037,-87.485719 41.680332,-87.475333
41.677447,-87.465205 41.675011,-87.443232 41.667574,-87.434992
41.658084,-87.443876 41.653338,-87.435615 41.646604,-87.43216
41.641409,-87.432332 41.630857,-87.432374 41.621907,-87.432418
41.611289,-87.433083 41.606523,-87.432718 41.600475,-87.432846
41.58709,-87.433018 41.577716,-87.432675 41.565902,-87.424092
41.560892,-87.423147 41.548814,-87.425594 41.540271,-87.439713
41.530443,-87.471643 41.520933,-87.493787 41.517463,-87.525721
41.516847,-87.52572 41.570552,-87.536797 41.574096,-87.545295
41.577723,-87.549801 41.577852,-87.568684 41.57737,-87.568727
41.587835,-87.56907 41.639941,-87.524953 41.625187,-87.525471
41.648549,-87.539761 41.6481,-87.539751 41.643562,-87.543345
41.646272,-87.548001 41.650056,-87.5362 41.650089,-87.533582
41.650056,-87.533625 41.648292,-87.525492 41.648549,-87.525029 41.676998))'
because: com.spatial4j.core.exception.InvalidShapeException:
Self-intersection at or near point (-87.52917652682729, 41.648432570220756,
NaN)","code":400}


Are there any workarounds to get self-intersecting polygon query to work?

Reply via email to