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

Street labels overlapping at high zooms with pitched views #5112

Closed
asheemmamoowala opened this issue Aug 7, 2017 · 3 comments
Closed

Street labels overlapping at high zooms with pitched views #5112

asheemmamoowala opened this issue Aug 7, 2017 · 3 comments
Assignees
Labels

Comments

@asheemmamoowala
Copy link
Contributor

https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-day-v2.html?access_token=<ACCESS_TOKEN>#19.63/33.86818/-118.28172/-176/45

mapbox-gl-js version: 0.39.1

Expected Behavior

Street label text does not overlap

Actual Behavior

screen shot 2017-08-07 at 11 49 07 am

@ChrisLoer ChrisLoer self-assigned this Aug 7, 2017
@ChrisLoer
Copy link
Contributor

It took me a while looking at that to visually figure out what was going on -- looks like the labels basically start doubling back on themselves at the midpoint. Could be a bug in the keepUpright logic. I'll take a look.

/cc @ansis

@ChrisLoer
Copy link
Contributor

Wow I had a tough time figuring this one out...

It turns out that if you're zoomed in far enough to a highly pitched tile, the bottom edge of the tile can come behind the camera, and our projection only works for points in front of the camera (there's a discontinuity as points cross the plane of the camera, then they flip orientation as their w values go negative). The flipping effect that shows up in the screenshot @asheemmamoowala posted comes because the first half of the label is oriented from the anchor (which is within the viewport and projected just fine) to the top vertex of the line segment (which is in the distance and projected just fine). The second half of the label is oriented from the anchor to the bottom vertex of the line segment -- whose x value will get projected more or less correctly, but whose y value will be flipped so it's past the top of the viewport.

Narrowing the field-of-view of the camera to ten degrees moves the camera back and fixes the problem, but of course changes the way pitched views look... I'm not sure what the best solution is here. We might have to check vertices to see if they cross the plane of the camera -- and if so, instead of using that vertex, we take a unit vector from tile space, project it, and then extend it to the edge of the viewport.

ChrisLoer added a commit that referenced this issue Aug 8, 2017
Adds special handling for (rare) case that line geometry projects to a point behind the plane of the camera.
ChrisLoer added a commit that referenced this issue Aug 8, 2017
Adds special handling for (rare) case that line geometry projects to a point behind the plane of the camera.
ChrisLoer added a commit that referenced this issue Aug 8, 2017
Without the fix:
 - The "viewport-overzoomed" test would show "Figueroa St." jumbled in the lower half of the screen
 - The "viewport-overzoomed-single-glyph" test would show the letter "C" upside down
ChrisLoer added a commit that referenced this issue Aug 22, 2017
Adds special handling for (rare) case that line geometry projects to a point behind the plane of the camera.
ChrisLoer added a commit that referenced this issue Aug 22, 2017
Without the fix:
 - The "viewport-overzoomed" test would show "Figueroa St." jumbled in the lower half of the screen
 - The "viewport-overzoomed-single-glyph" test would show the letter "C" upside down
ChrisLoer added a commit that referenced this issue Aug 23, 2017
Adds special handling for (rare) case that line geometry projects to a point behind the plane of the camera.
ChrisLoer added a commit that referenced this issue Aug 23, 2017
Without the fix:
 - The "viewport-overzoomed" test would show "Figueroa St." jumbled in the lower half of the screen
 - The "viewport-overzoomed-single-glyph" test would show the letter "C" upside down
@asheemmamoowala
Copy link
Contributor Author

asheemmamoowala commented Aug 31, 2017

Fixed in #5120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants