A control that enables users to add points to a map by clicking the map, and
then clicking those points to remove them. Like the boxselector control, it
calls a callback with the current map data, and also exposes an API,
addLocation(com.modestmaps.Location)
, if you wish to add points on pageload.
<div id='map-div'></div>
<div id='pointselector-text'></div>
<script>
var mm = com.modestmaps;
wax.tilejson(
'https://api.tiles.mapbox.com/v3/mapbox.blue-marble-topo-bathy-jul.jsonp',
function(tilejson) {
var m = new mm.Map('map-div',
new wax.mm.connector(tilejson))
wax.mm.pointselector(m, tilejson, {
callback: function(coords) {
$('#pointselector-text').text(coords.join(' - '));
}
});
m.setCenterZoom(new mm.Location(39, -98), 2);
}
);
</script>
var pointselector = wax.mm.pointselector(map, tilejson, options)
coords
, containing a list of coordinates of
points that you've selected.
pointselector.addLocation(com.modestmaps.Location)
pointselector.deleteLocation(location)
pointseletor.remove(map)
pointselector.locations()