Real-life examples
Reflect user location
This section shows an example of how to reflect the client location on the map using markers.
const map = new jsVectorMap({
async onLoaded(map) {
const response = await fetch('https://ipinfo.io/geo')
const data = await response.json()
map.addMarkers({
coords: data.loc.split(','),
name: `${data.city} - ${data.country} (${data.ip})`
})
}
})