Using Mapbox boundaries to fix disputed nations borders.

Ilyasbenhssine
2 min readAug 30, 2022

I’ve met a lot of people trying to show a map on a specific worldview other than the most common worldviews [US, CN, JP, IN] .

I’m from morocco and to use maps on any product that will be served to moroccan people need to respect our world view. this how morocco is displayed using the US world view. and sadly there is no world view that match morocco worldview.

The boundaries of the Kingdom of Morocco, with a disputed area “Western Sahara” based on the US Worldview.

To fix this problem you can change the world view of the layers example using GLJS:

const WORLD_VIEW = "MA"
var adminLayers = ['admin-0-boundary', 'admin-1-boundary', 'admin-0-boundary-disputed', 'admin-1-boundary-bg', 'admin-0-boundary-bg', 'country-label'];
adminLayers.forEach((adminLayer) => {mapInstance.setFilter(adminLayer, ["match", ["get", "worldview"], ["all", WORLD_VIEW], true, false]);});

this will change the boundaries layers and the country-label layer and will transform the map to this

The boundaries of the Kingdom of Morocco with no disputed area boundaries and no Western Sahara Country Label based on “MA” Worldview.

Little trick to achieve the same result using only the Map box studio.

(this will require to publish a theme.)
To get Started first you have to create your own theme or duplicate the one you like, and then go the Administrative boundary and scroll to the Worldview options sadly it doesn’t show the Moroccan world view but a little trick and make it visible.

Open the dev tools and inspect the worldview Select element. now you can add a new options or just simple change one of the options to your Region Code. my case "MA" change the value to the desired Worldview code.

then you can open the select and you’ll see your region code showing select it and voila you can do the exact same thing for the Place labels to hide country names depending on your world view.

now you can publish the theme and the world view will be visible on all your clients “Android”, “IOS”, “Web” …

--

--

Ilyasbenhssine
0 Followers

Hey my name is Ilyas From Morocco, Rabat. I’m a Software Engineer.