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.26k stars 2.23k forks source link

Mapbox GL JS: Some coordinates are not rendered #8790

Open karanml opened 5 years ago

karanml commented 5 years ago

I'm processing a multi-polygon geojson, but some polygons are not rendered with mapbox-gl-js, generating some gaps. The use of mapbox-js features renders correctly. This problem only occurs with the mapbox-gl-js API. This problem also occurs in Mapbox Studio when rederizing a tileset in a style even though the polygon exists in the dataset.

That's the link to the geojson: geojson

This is the code snippet where I add the layer, with mapbox-gl-js: Result map.addSource( < id > , { type: 'vector', url: < url > }); map.addLayer({ "id": < id > , "type": "fill", "source": < id > , "source-layer": < id > , "layout": {}, "paint": { "fill-color": ["interpolate", ["linear"], ["get", "title"], 0.00, "red", 0.30, "#8aac75", 0.60, "#00e6e6", 0.90, "#00c0cc", 1.20, "#00a5cc", 1.50, "#007fcc", 1.80, "#000066", 2.10, "#0018cc", 2.40, "#0000ba", 2.70, "#000099", 3.00, "#000076", 3.30, "#000066", 3.60, "purple" ] } }, < layerId > );

This is the code snippet where I add the layer, with mapbox-js: Result var featureLayer = L.mapbox.featureLayer().addTo(tmap); featureLayer.loadURL('/geojson');

Would anyone know what may be generating this error?

mourner commented 5 years ago

Try reducing the GeoJSON simplification tolerance. It affects the threshold under which polygons are considered too small and are dropped.

karanml commented 5 years ago

Thank's @mourner ! Already test with tolerance from 0 to 10 on addSource(). Is there any specific setting I can test?

mourner commented 5 years ago

Can you set up a live minimal JSFiddle test case so that I could take a look?

karanml commented 5 years ago

Hi, @mourner . Sorry for the delay. I was reviewing feedback from Mapbox support. This is the link to the example processing attached geojson: Example

mourner commented 5 years ago

Hmm, I don't see any rendering issues here — it looks like the tile data generated from GeoJSON comes in this way. How did you generate the tileset — upload the GeoJSON directly to Studio? It might be that our current pipeline simplifies the polygons too aggressively. Maybe worth trying something like https://github.com/mapbox/tippecanoe, or the new Tilesets API beta?

karanml commented 5 years ago

We upload to Studio, but even serving as an external API, rendering in mapbox-gl-js shows the gaps. With mapbox-js it works correctly.