ckanext-spatial icon indicating copy to clipboard operation
ckanext-spatial copied to clipboard

Support for multipolygon geometries

Open groundrace opened this issue 11 years ago • 3 comments

Multipolygons are largelly used for acipelag and country and regional borders but unfortunatelly are not supported by the extension. It seems SOLR have sypport for it already when using JTS

groundrace avatar Jan 07 '14 22:01 groundrace

If you are using the solr-spatial-field backend for the spatial search, and your geometry is a valid MultiPolygon, the search should work just fine.

This extent works for me (by works I mean that the dataset is found on a spatial search):

kf9priv

{"type":"MultiPolygon", "coordinates": [[[[-62.637519836425774,17.09321364464215],[-62.637519836425774,17.20868918828472],[-62.537612915039055,17.20868918828472],[-62.537612915039055,17.09321364464215],[-62.637519836425774,17.09321364464215]]],[[[-62.87200927734374,17.214264312027566],[-62.87200927734374,17.41616680065724],[-62.60696411132812,17.41616680065724],[-62.60696411132812,17.214264312027566],[-62.87200927734374,17.214264312027566]]]]}

But not this one:

5yivura

{"type":"MultiPolygon","coordinates":[[[[-62.89947509765625,17.197210463331256],[-62.89947509765625,17.42271835184761],[-62.589111328125,17.42271835184761],[-62.589111328125,17.197210463331256],[-62.89947509765625,17.197210463331256]]],[[[-62.65777587890625,17.06728740376787],[-62.65777587890625,17.219511333785114],[-62.51495361328124,17.219511333785114],[-62.51495361328124,17.06728740376787],[-62.65777587890625,17.06728740376787]]] ]}

Note that on the second one the polygons are overlapping. This is flagged as an invalid geometry by shapely, the library that we use to validate them:

WARNI [shapely.geos] Self-intersection at or near point -62.589111328125 17.219511333785114

(The proper way to go in this case would probably be a GeometryCollection with two Polygon objects but that is not supported in CKAN) If I bypass the validation for this particular case, Solr indexes the geometry just fine and the dataset is found on a spatial search. I'd need to investigate a bit more to see if we can add an exception for this particular case.

amercader avatar Feb 12 '14 16:02 amercader

that would be nice as I got the same error for the overlapping geometries that reflect my case i.e (Vatican City or San Marino part of the Italy borders are a shapes not overlapping but even contained into the main one).

groundrace avatar Feb 13 '14 21:02 groundrace

Hi everyone, has there been any progress on this? What is the current recommended workaround when migrating from PostGIS, where overlapping Multipolygons worked correctly, to newer versions of CKAN without PostGIS? Thanks!

ChristianF88 avatar Nov 29 '23 08:11 ChristianF88