Wednesday, July 27, 2005
Ruby Banner Retail
I've added the two shops where Jane is currently selling her jewellery to a Google Map to look at how markers are programmed. Click on the marker to get the address of the shop.
It is comapartively straightforward:
var point = new GPoint(-0.2024,51.5128);
var marker = new GMarker(point);
map.addOverlay(marker);
var html = "Oi, 77 Portobello Road, Notting Hill Gate, London W11 2QB. Tel: 020 7221 0472";
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
You add a point, create a marker from it, and then overlay it on the map. The address is displayed by listening to the click event for the marker.
I am not sure that I have geocoded the addresses as accurately as perhaps I might, but the markers are close to the genuine locations.
(I have noticed that Google have added a new Hybrid view since last time I used the API.)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment