Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

port circle querying fixes #11571

Merged
merged 4 commits into from
Apr 26, 2018
Merged

port circle querying fixes #11571

merged 4 commits into from
Apr 26, 2018

Conversation

ansis
Copy link
Contributor

@ansis ansis commented Mar 30, 2018

Fix #10615

port mapbox/mapbox-gl-js#6036 to -native

The fixes include:

  • support for querying circles that cross tile boundaries
  • support for querying circles with circle-pitch-alignment=map
  • support for querying circles with circle-pitch-scaling=viewport
  • fix for unnecessarily duplicated result features

@ansis ansis requested a review from ChrisLoer March 30, 2018 20:34
@jfirebaugh
Copy link
Contributor

Can you retarget this at release-boba? 🙏

@ansis ansis force-pushed the port-circle-query-fix branch from da2e451 to 785fd40 Compare March 30, 2018 22:25
@ansis ansis changed the base branch from master to release-boba March 30, 2018 22:26
@ChrisLoer
Copy link
Contributor

I started taking a look at this but wanted to get it building first. The rebase got a little ugly because of some changes I had made and because of a conflict on the gl-js pin. I made a new branch and cherry picked everything but the pin change -- the branch is cloer-port-circle-query-fix, if it looks good you can force-push it over this branch. However the 'box-cutting-antimeridian-z0' and 'null-island' query tests are still failing, I haven't figured out why yet.

auto stroke = evaluated.evaluate<style::CircleStrokeWidth>(zoom, feature);
auto size = radius + stroke;

// For pitch-alignment: map, compare feature geometry to query geometry in the plane of the tile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: tab -> spaces for leading white space

@ansis ansis force-pushed the port-circle-query-fix branch 2 times, most recently from 1578373 to e29cea3 Compare April 16, 2018 20:32
@ansis
Copy link
Contributor Author

ansis commented Apr 16, 2018

@ChrisLoer thanks for the rebase. I've updated the branch and the query tests are now passing. Did you want to review this further?

Copy link
Contributor

@ChrisLoer ChrisLoer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left one question about testing overscaled tiles, but I didn't actually see a problem, it's just an area where it's easy to get confused since native and js store overscaling info differently.

for (const RenderTile& renderTile : sortedTiles) {
const float scale = std::pow(2, transformState.getZoom() - renderTile.id.canonical.z);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using renderTile.id.canonical.z here instead of this.tileID.overscaledZ as in GL JS caught my eye. I think the reason is that here we're using the hardwired util::tileSize, while the equivalent tile.tileSize in JS has the power-of-two overscaleFactor built into it.

Which just leaves me wondering -- did you do any manual tests with overscaled tiles, or would it make sense to add an explicit overscaled test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test with overscaled tiles. What do you see as a better way to test this? a query test or a unit test somehow? I'm leaning towards query test but I think it could be tricky to set it up so that it fails just when the overscaling isn't accounted for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a manual test I'd just zoom into z20 or something with some pitched circles and see that the queries hit where we expect. For the query tests, we could just set them to use overscaled tiles, so that the functionality was getting exercised. Outside of regression tests, I don't think there's a specific "test for overscaling" since of course it can break in lots of different ways.

I am 👍 on merging either way.

This fixes circle querying for cases where either
    circle-pitch-alignment=map
or
    circle-pitch-scaling=viewport
@ansis ansis force-pushed the port-circle-query-fix branch from e29cea3 to 89069ee Compare April 26, 2018 21:03
@ansis ansis changed the base branch from release-boba to master April 26, 2018 21:09
ansis and others added 2 commits April 26, 2018 17:13
Previously we relied on tile buffers for querying features who's
rendered representations cross tile boundaries. Now we query multiple
tiles making it unnecessary to index features that are completely
outside a tile's boundaries.
@ansis ansis force-pushed the port-circle-query-fix branch from 89069ee to c7dcdb9 Compare April 26, 2018 21:13
@ansis ansis merged commit 1a39d7d into master Apr 26, 2018
This was referenced May 23, 2018
@friedbunny friedbunny deleted the port-circle-query-fix branch May 23, 2018 17:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

queryRenderedFeatures failing for circle layers on a tile boundary
3 participants