Number of latitude and longitude in geo_polygon search

When I perform a geo_polygon query, we usually need to give a set of latitude and longitude, and query documents whose geo points are within the geographic polygon.

We are considering limiting the number of latitudes and longitudes to prevent users from drawing a very complex geographic polygon: it contains too mutch points so the quey took a long time.

Do you have a suggested number of latitude and longitude in geo_polygon search?

@Nathan_Reese or @nickpeihl can u please throw some light on this...

Thanks
Rashmi

Do you have a suggested number of latitude and longitude in geo_polygon search?

It really depends on your cluster size, data size, and cluster utilization. You will have to experiment to find the right balance for your environment. We have seen no performance problems for polygons with hundreds of points.

We are considering limiting the number of latitudes and longitudes to prevent users from drawing a very complex geographic polygon: it contains too mutch points so the quey took a long time.

There are line simplification algorithms that may help reducing the number of coordinates. But you may need to experiment to determine the parameters to use with these algorithms.

Another factor to consider is limiting the precision of the coordinates. Six decimal places is more than enough precision for most use cases. Many UI drawing tools for maps, such as https://geojson.io, create coordinates with far more precision than necessary (or even realistically possible).

1 Like

Thanks, I'll do some experiment.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.