We're currently developing a feature for a map project utilizing Elasticsearch vector tile search (MVT).
Our feature is displaying individual document location points. (Points, not polygons).
The problem we're seeing is that the points move around as the zoom level increases.
I understand this is a performance optimization for polygons, as the resolution of the polygon changes with zoom levels.
For individual points, this isn't ideal, as a user may select a point , and as they zoom in, the point moves to a different location.
Should the vector tile search API preserve POINT(x, y) location data?
Should we even use MVT for individual data points? Or is it better suited for polygons?
Thank you for any help!
Welcome to the community. Hope the answer to your questions are helpful:
- Should the vector tile search API preserve POINT(x, y) location data?
No, as a vector tile does not know anything about latitude and longitude. A position inside a tile is defined in pixels coordinates. In order to transform lat/lon coordinates in WGS84 in a vector tile feature we need to project the coordinate into spherical mercator and then into pixel coordinates:
WGS84 -> Spherical mercator -> Vector tile pixels
Therefore, the precision is defined by the pixel precision of the vector tile. The precision is set by the extent of the tile which by default is 4096. Increasing that number, it will increase the precision but potentially the size of the tile as well. (Note that the maximum allowed is 8096)
- Should we even use MVT for individual data points? Or is it better suited for polygons?
I think vector tiles can be used for point data but we need to be aware that the maximum number of documents included in a vector tile are 10k, the rest are ignored. This behaviour is inherited from Elasticsearch as it is the maximum number of documents a query can return.
Polygon data is ordered by size so as you zoom in you might be seeing small features that were not visible when you were zoomed out. For points the behaviour is less defined as all points are weight the same so you might want to add your own ordering.
Thank you so much for your response. This clears things up a lot.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.