mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.24k stars 2.23k forks source link

Tileset data partially disappearing at certain zoom levels #7113

Closed troutinsights closed 6 years ago

troutinsights commented 6 years ago

Similar to Issue #5013, I am seeing part of my tileset data disappear at certain zoom levels.

I have a 4 MB geoJSON file (attached), derived from QGIS which takes a clip operation of several large polygon layers on a polyline layer. The original line that was clipped does not have this issue. The resulting clipped geoJSON polyline file is imported in MapBox Studio. The tileset says z0-z13. In Mapbox Studio (and in the iOS implementation), zoom 0-12 work, but at z12.x+ some (not all!) of the lines disappear for any zoom more than z12. I have not used canoetipper or any other operation other than QGIS, which merges a bunch of polygon layers into one and then does the clipping against the line layer. The only thing I can think of is the clip operation in QGIS inherits some max_zoom properties into the line layer for certain objects? Has anyone else encountered this? I will try different clipping operations to see if I can narrow down the problem.

mapbox-gl-js version: mapbox studio

browser: chrome

Steps to Trigger Behavior

  1. In Mapbox Studio, upload this data to any style as a new dataset wi-dnr-sections.geojson.zip

  2. Go to "River Falls, WI" on the map. Zoom to level 11, see all the lines, great. Now zoom to 12.4. Many of the lines around River Falls, WI disappear.

Link to Demonstration

https://jsbin.com/

Expected Behavior

No lines disappear outside of the max/min zoom constraints.

Actual Behavior

ryanhamley commented 6 years ago

Hi @troutinsights are you able to reproduce this as a minimal Mapbox GL JS example in JSBin? That would be very helpful in trying to figure out the issue.

troutinsights commented 6 years ago

Hi @ryanhamley, I don't have a JS example- only iOS SDK (which I have available if useful). But it should be pretty quickly and easily reproducible just loading the attached geoJSON into anyone's MapBox Studio web browser.

troutinsights commented 6 years ago

Update: If I take the same dataset from QGIS and upload it to Mapbox Studio as a KML format (so skip the geoJSON conversion step), the zooming issue goes away. However, by doing that it looks like I lose all my attribute properties of the object so I can't quite use this as a workaround.

mollymerp commented 6 years ago

@troutinsights are you experiencing this issue with GL JS or with only iOS? The iOS SDK uses mapbox-gl-native, so if you can't reproduce in JS please open a ticket in that repo.

troutinsights commented 6 years ago

Hi @mollymerp, I am seeing the issue in GL JS as well via Mapbox Studio, hence I don't think its an iOS SDK issue. Reproducing the problem is very straight forward using a internet browser and Mapbox Studio (apologies for lack of technical terminology and info here, not a web developer). More specific reproducing steps: 1) In Chrome (probably any browser), go to https://www.mapbox.com/studio/tilesets/ 2) Upload the above geoJSON that I attached in this thread, which was derived in QGIS using clipping tool. 3) Go to the Style page here: https://www.mapbox.com/studio/ 4) In any style editor, create a new layer and reference the newly created tileset above 5) Zoom in past z12 and see some data disappear.

Hope that helps and thanks for the help!

mollymerp commented 6 years ago

Ok, this sounds like an issue with our uploads pipeline and not with this library. I tested the data as a GeoJSON source and didn't notice anything out of the ordinary. Can you please post a link to your tileset id so we don't have to re-upload? Thanks!

troutinsights commented 6 years ago

No problem. The example data set is at this ID: troutinsights.1w8o9vrz

Note that its not all the data, just some snippets. For example, in MapBox Studio Style editor with the new dataset enabled, zoom into River Falls, WI and see the polylines that follow the stream just to the northeast of the city. Most of that section disappears above z12.

mollymerp commented 6 years ago

@troutinsights I checked out the tileset, and I do think it is an issue with the Mapbox uploads pipeline, not gl js. It isn't a maxzoom issue because tiles at Z12 are being generated, they're just losing some features within the tile (if you set the show tile boundaries debug option in studio, you can see what I mean. I will cut a ticket internally to see if they can debug why, but in the meantime, a workaround would be just using the geojson and loading it with map.addSource()` at runtime.

troutinsights commented 6 years ago

Thanks @mollymerp! Can you elaborate on the workaround? Using Mapbox iOS SDK I load this geoJSON dataset during the ViewDidFishingLoading per most of the standard examples and get the same behavior we have been seeing in Mapbox Studio. Is there something different I should try as a workaround on iOS?

yorindezomer commented 4 years ago

Is this already solved? I've the same issue: at zoomlevel 12 a few icons are disappearing, while the settings are set at "allow icon overlap". When zooming in our out, the icons are appearing again.

Does somebody knows it this is something that can be fixed? Because this topic is from 2018

MapZombie commented 4 years ago

Is this already solved? I've the same issue: at zoomlevel 12 a few icons are disappearing, while the settings are set at "allow icon overlap". When zooming in our out, the icons are appearing again.

Does somebody knows it this is something that can be fixed? Because this topic is from 2018

Also having what sees like the same issue. Doesn't seem to be resolved.

brent-williams commented 3 years ago

@mollymerp can you update on the status of the internal ticket. The workaround is not usable in places where the bug manifests with Mapbox's own datasources e.g. mapbox.boundaries-adm2-v3:

Zoom 2.01 (OK):

Zoom_2 01_

Zoom 1.99 (not OK, partial data missing):

Zoom_1 99_
planemad commented 3 years ago

@brent-williams since showing all boundaries at all zoom levels would exceed the vector tile size limits, a per country zoom value is chosen at which the boundaries for a country becomes visible. You will find this z_min value in the corresponding boundary reference files.

Top level boundary divisions usually have a lower z_min value that you can use at lower zoom level eg adm1 and adm0 boundaries.

brent-williams commented 3 years ago

@planemad thanks for the feedback, it is a very important issue for our particular application and I want to understand your answer. Certainly tile size limits must be respected, but I believe your z_min is essentially aesthetically determined as in other datasets you are making topological changes which allows you to keep the tilesize within basically whatever limits you wish right down to level zero. This can be seen in e.g. landuse/parks, below. There is topologically decimation (basically, small parks are removed) at zoom 8, 7, and then suddenly a seemingly arbitrary, aesthetic decision was made to switch to simply cutting off all the data for zoom 6 through 0.

I see no technical reason why the parks decimation couldn't be taken to zoom zero, would you agree? Likewise, with the administrative boundaries e.g. US counties, through topological changes such as collapsing small counties to a single point that data could also be taken to zoom level 0.

It's very important for one of our use cases, namely creating small previews of very large final target resolutions (e.g. 16K x 16K). Because the data arbitrarily snaps off at low zooms, I can't provide a fast representative preview, basically data in the preview is blank (e.g. parks at zoom level 2 for a 1K preview) whereas it's visible on the final render (e.g. parks at zoom level 6 for a 16K preview).

Any ideas/thoughts/suggestions much appreciated.

Zoom ~8 landuse/parks, ~ 100 parks

8LandUseParks

Zoom ~7 landuse/parks, ~43 parks

7LandUseParks

Zoom ~6 landuse/parks, 0 parks, at least 3 should still easily be visible at this zoom level as they are > 2x the size of other parks visible at zoom level 7

6LandUseParks
planemad commented 3 years ago

@brent-williams Note that there exists a boundaries point tileset mapbox.boundaries-admPoints-v3 where the centroid points of each boundary will be visible one zoom level earlier than the corresponding boundary polygons which might be what you need.

At z0 most polygons will be smaller than a pixel and are not practically useful to display on a map.

brent-williams commented 3 years ago

@planemad wrote:

At z0 most polygons will be smaller than a pixel and are not practically useful to display on a map.

There are many tricks such as polygons, alpha, etc. that can be used to great effect in reaching subpixel lines. That's my point, the cutoff at 2 for US counties and 5 for parks etc. are aesthetic judgements in the Mapbox processing pipeline that could be changed, can you confirm this?

If so Mapbox may not wish to make any changes to e.g. the Boundaries API. But to address the needs of OP, the several others above and myself I'd like to determine if some solution might be possible, if not as part of the current public APIs then perhaps as part of professional services, for example.

fallenartist commented 2 years ago

I'm seeing similar issue with imported polyline partially disappearing in Studio, depending on zoom level. I'm a beginner so I might have not checked everything though. Data has been imported as GeoJSON from Overpass Turbo.

See here.

wklumpen commented 9 months ago

This issue appears to still be happening - I am losing some polygons at mid-level zooms.

Does anyone know if this is still being worked on?

Example: https://studio.mapbox.com/tilesets/wklumpen.CHI-20201116-SATAM-tiles

Zoom level 10 looks fine, 9.6 does not.

Screencast from 2024-02-27 02 18 53 PM