Examples for Use Case: Add a custom control to a map

These examples use a custom control which is updated to show the latitude and longitude of the map centre when the map is moved. The map is initialised with a marker at its central point. When the map has been moved to another position, the "Mark" button will move the marker to the new centre. Whenever the map has been moved such that the marker is not at the centre, the "Return" button will re-centre the map on the marker.

Jump to section…

Google Maps embed

Not applicable

OpenStreetMap embed

Not applicable

Bing Maps embed

Not applicable

MapBox Studio embed

Not applicable

Leaflet.js (with OpenStreetMap tiles)

OpenLayers with OpenStreetMap tiles

Google Maps

Bing Maps Control API

MapKit JS (Apple Maps) API

Not applicable.

MapBox GL

TomTom Maps SDK for Web with vector maps


D3 Geographies APIs