Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created September 3, 2018 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/bc46251967538519794d0cf8e2c6a28b to your computer and use it in GitHub Desktop.
Save fitomad/bc46251967538519794d0cf8e2c6a28b to your computer and use it in GitHub Desktop.
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