Hi Nick, You are correct. As-is you would need a geospatial pair index on two paths since long and lat value are embedded in the XML as separate values. The closest you can get is with a geospatial-path-index on basic:location-point/basic:coordinates. That will reject below XML though, because the string-value of coordinates gets normalized to ‘-1020’. If you add a comma between the two item elements it isn’t rejected, and indexed properly.
In other words, you will need to touch the data at ingest time to get around this. But the change can be pretty minimal.. Kind regards, Geert From: Nick Ardlie <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, January 8, 2015 at 4:23 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] MarkLogic Geospatial indexing strategy for XML representation of GeoJSON Given the following JSON document (with GeoJSON-compliant Point and Polygon attributes): {"_id":"123", "location-point":{"type":"Point", "coordinates":[-10, 20]}, "location-poly":{"type":"Polygon", "coordinates":[[[-10, 20], [-10, 30], [0, 20], [-10, 20]]]}} The default MarkLogic (7.0) XML representation of this document looks like this: <?xml version="1.0" encoding="UTF-8"?> <json type="object" xmlns="http://marklogic.com/xdmp/json/basic"> <__id type="string">123</__id> <location-point type="object"> <type type="string">Point</type> <coordinates type="array"> <item type="number">-10</item> <item type="number">20</item> </coordinates> </location-point> <location-poly type="object"> <type type="string">Polygon</type> <coordinates type="array"> <json type="array"> <json type="array"> <item type="number">-10</item> <item type="number">20</item> </json> <json type="array"> <item type="number">-10</item> <item type="number">30</item> </json> <json type="array"> <item type="number">0</item> <item type="number">20</item> </json> <json type="array"> <item type="number">-10</item> <item type="number">20</item> </json> </json> </coordinates> </location-poly> </json> Taking the simpler case of the Point, is there a MarkLogic geospatial indexing strategy that will support this serialisation? Element Pair Indexes would appear to require unique local names for lat and lon, and Path Indexes would appear to require identification of a single text node or attribute. What approaches would people recommend to support geospatial search of GeoJSON geometry types in MarkLogic? Regards, Nick
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
