Search code examples
geospatialmarklogic

What is the default tolerance for ETRS89 in geospatial operations if the user does not specify any?


In Marklogic I'm using cts.geospatialRegionQuery to search for documents that contain (an indexed) geometry that has an intersection with the geometry I search with.

The geospatial region index uses etrs89/double as coordinate system. All geometries in the data have 9 decimal places.

According to the Marklogic Geospatial search applications documentation:

[...] geospatial queries against single precision indexes are accurate to within 1 meter for geodetic coordinate systems.

I would, therefore, expect that my queries would have sub-meter accuracy. However, I get search results from cts.geospatialRegionQuery containing geometries up to ~5 meters away from my search geometry. As far as I can see the only reason for this could be the tolerance option that I'm not specifying yet and is therefore using the default.

The documentation mentions that

If you do not explicitly set tolerance, MarkLogic uses the default tolerance appropriate for the coordinate system. To ensure accuracy, MarkLogic enforces a minimum tolerance for each coordinate system.

This brings us to the actual question:

What is the default (and minimum) tolerance for the etrs89 coordinate system in Marklogic?

EDIT: Looked further into the issue with help from Marklogic Support and found the cause of the low accuracy of my geospatial queries.

Before using cts.geospatialRegionQuery I parsed the search geometry with geo.parseWkt. This function does not allow you to explicitly set the coordinate system to be used and therefore uses the coordinate system set in the AppServer settings. By default this is single precision wgs84. This lead to a loss of 2-3 digits on my search geometry.

After setting the coordinate system to etrs89/double in the AppServer settings, geo.parseWkt didn't reduce the precision of the search geometry anymore and my geospatial queries had the expected 5 mm accuracy.


Solution

  • The default tolerance for WGS84 and ETRS89 coordinate systems is 0.5cm for double precision and 5 meters for single precision.