This is the documentation of version 1.0.0-rc.2. Go to the latest version, 1.0.0-rc.5.

Geopolitical views

Borders, names and addresses are disputed in many places, and what is correct depends on who is looking. A geopolitical view sets whose perspective the SDK shows in the borders and names the map draws, and in the country a search or reverse geocoding result reports. One setting controls both, so the map and your results never contradict each other.

Pick a territory and a view below. The borders redraw, and the address of the pinned place updates.

Supported views

geopoliticalViews, exported from the Core bundle, lists every view as the GeopoliticalView type:

View Perspective
Unified International: disputed borders drawn as disputed
AE Arabic: Bahrain, Kuwait, Oman, Qatar, Saudi Arabia and the United Arab Emirates
AR, BN, CL, CN, DZ, IL, IN, KR, MA, MY, PH, PK, RS, RU, TR, TW, US, VN The country with that ISO 3166-1 code

Examples of what the views change:

Not every TomTom API supports every view:

API Views it doesn't support
Map vector tiles CN, RU
Search, place details, reverse geocoding KR, US
Geocoding AE, BN, CL, DZ, KR, MY, PH, US, VN

If an API doesn't support a view, the SDK leaves the view out of its requests to it, so the call still succeeds in that API's default view.

Setting the view

Set the view once in the global configuration, and it applies to the map and to every search, place details, geocoding and reverse geocoding call:

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';

TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY', geopoliticalView: 'IN' });

A map's constructor or a single call can override it:

import { TomTomMap } from '@tomtom-org/maps-sdk/map';
import { reverseGeocode } from '@tomtom-org/maps-sdk/services';

const map = new TomTomMap({ mapLibre: { container: 'map' }, geopoliticalView: 'PK' });

const address = await reverseGeocode({ position: [74.31, 35.92], geopoliticalView: 'Unified' });

When no view is set

If you don't set a view, each TomTom API applies the default view for the country the request comes from, as local law there requires. Requests from India always get the IN view, whatever view you set.

Switching the view on a map

setGeopoliticalView changes the view of a map that is already showing:

map.setGeopoliticalView('IN');

// Back to the default view for the viewer's country
map.setGeopoliticalView(undefined);
TomTomConfig.instance.put({ geopoliticalView: 'IN' });
map.setGeopoliticalView('IN');

Related guides and examples