I am trying to build a data visualization website and I didn't find how to build the map object without any style (or an "empty-like style") so only my vector data can be seen (a GeoJSON of some administrative areas limited to a particular country and some markers and popups with simple descriptions).
I am looking for something like image below, but without the world map. Just the upper layers (the blue ones).
-
Hi and welcome on GIS.se, don't really get what you want to remove from your map. Can you add some images to your question on what is on the mapbox map and you want to remove ? widgets, basemap, etc...Pierrick Rambaud– Pierrick Rambaud2021年06月02日 05:05:19 +00:00Commented Jun 2, 2021 at 5:05
-
1You should be aware if you use your own tiles, you should always use a mapbox token as billing is based on map load (same price if it's mapbox tiles or 3rd party) See github.com/mapbox/mapbox-gl-js/issues/10162 Depending on your case, you may switch to maplibre.js github.com/MapLibre/maplibre-gl-js (a forked version of latest mapbox 1.x series, before license changes)ThomasG77– ThomasG772021年06月16日 15:08:38 +00:00Commented Jun 16, 2021 at 15:08
1 Answer 1
To remove the basemap from the example shown in your question (https://docs.mapbox.com/mapbox-gl-js/example/hover-styles/), just replace
style: 'mapbox://styles/mapbox/streets-v11'
with
style: {version: 8,sources: {},layers: []}
which is an "empty" style without sources and layers.
Here's a demonstration: https://jsbin.com/fowoluyawo/1/edit?html,output
-
Thanks this was a super helpful answer to me. Cheers...ChrisO– ChrisO2024年09月17日 16:56:34 +00:00Commented Sep 17, 2024 at 16:56