Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector tiles: order hits by geometry size by default (#75621) #75748

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Jul 27, 2021

Vector tiles can only display polygons and lines that are big enough for the precision of the tile. This might create strange results where the hits layer of a vector tile contains no data even though the query have hits. In order to provide expected results we are ordering the hits result by geometry size so we always render polygon and lines which are big enough on respect to the tile precision.

The first issue is to define how to compute the geometry size. This size needs to computed in respect to the spherical mercator projection as it introduces distortion. In this approach we use the diagonal size of the geometry bounding in the spherical mercator projection as ordering value.

In order to perform this, we introduce the following changes:

Introduce two new methods in our ScriptDocValue geometry interface:
** getMercatorWidth(): width of the geometry in the spherical mercator projection.
** getMercatorHeight(): Height of the geometry in the spherical mercator projection.

Move SphericalMercatorUtil to server under common/geo.

Then if there is no ordering provided by the user when calling the _mvt API and the size of the request > 0, then we add a order by using a script that computes the diagonal of the geometry square. This is used to order the results.

Note: We have consider to use filtering but this would affect the results on the aggregation.

backport #75621

iverase and others added 2 commits July 27, 2021 18:35
_mvt end point gives priority to geometries with larger area
@iverase
Copy link
Contributor Author

iverase commented Jul 27, 2021

@elasticmachin run elasticsearch-ci/packaging-tests-windows-sample

@iverase iverase merged commit 5857a4d into elastic:7.x Jul 28, 2021
@iverase iverase deleted the backport75621 branch July 28, 2021 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant