Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function centerMap(coordinates)
let latitudes = {
return element.latitude;
let longitudes = {
return element.longitude;
let longitudeMax = Math.max.apply(null, longitudes);
let longitudeMin = Math.min.apply(null, longitudes);
let latitudeMax = Math.max.apply(null, latitudes);
let latitudeMin = Math.min.apply(null, latitudes);
let boundingRegion = new mapkit.BoundingRegion(latitudeMax, longitudeMax, latitudeMin, longitudeMin);
let region = boundingRegion.toCoordinateRegion();
map.setRegionAnimated (region, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment