Instantly share code, notes, and snippets.

Embed
What would you like to do?
venues = JSON.parse("...json document...");
// Annotations
let annotations = venues.map(function(venue) {
let coordinate = new mapkit.Coordinate(venue.spatial.latitude, venue.spatial.longitude);
let options = {
url : {
1 : "images/venues/" + venue.id + "@1x.png",
2 : "images/venues/" + venue.id + "@2x.png",
3 : "images/venues/" + venue.id + "@3x.png"
},
size : {
width : 50,
height : 50
},
accessibilityLabel : venue.title
};
var annotation = new mapkit.ImageAnnotation(coordinate, options);
// Clustering setup
annotation.clusteringIdentifier = "AustriasCollectionCluster";
annotation.collisionMode = mapkit.Annotation.CollisionMode.Circle;
annotation.displayPriority = mapkit.Annotation.DisplayPriority.High;
// Añadimos el Event Listener
annotation.addEventListener("select", austriasAnnotationSelected, venue);
return annotation;
});
map.showItems(annotations);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment