8

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).

Example

2
  • 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... Commented Jun 2, 2021 at 5:05
  • 1
    You 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
    Commented Jun 16, 2021 at 15:08

1 Answer 1

13

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.