9

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

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 2, 2021 at 4:16
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) Commented Jun 16, 2021 at 15:08

1 Answer 1

15

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

answered Jun 3, 2021 at 4:50
1
  • Thanks this was a super helpful answer to me. Cheers... Commented Sep 17, 2024 at 16:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.