Google Map API add pushpin on custom tile map
I have custom tiles where I can zoom in and out of. I'm following this
example:
http://blog.mikecouturier.com/2011/07/create-zoomable-images-using-google.html#maps_conclusion
I have my own site and am pointing to my own images. how do I have the map
recognize an onclick event to then call javascript to place a pushpin at
that location? I also want to display the map coordinates in the tooltip
for the pushpin.
so far I've tried:
Demo.KoalaMap = function (container) {
// Create map
this._map = new google.maps.Map(container, {
zoom: 1,
center: new google.maps.LatLng(0, -20),
mapTypeControl: false,
streetViewControl: false
});
google.maps.event.addListener(this._map, 'click', function(event)
{
addMarker(event.latLng);
});
//google.maps.event.addListener(this._map, 'click', function(event)
//{
// marker = new google.maps.Marker({position: event.latLng, map:
this._map});
//});
function addMarker(location)
{
marker = new google.maps.Marker({
position: location,
map: this._map
});
markersArray.push(marker);
}
I'm able to view and zoom around the image btu then clicking does nothing.
How do I get the pushpin to pop-up when I click somethere?
No comments:
Post a Comment