Date: 2010mar3
Language: javaScript
Q. With Google Maps, how can I geo-search for one address and mark it
with something else?
A. Here you go:
map = new GMap2(document.getElementById('map_canvas'));
geocoder = new GClientGeocoder();
function showAddress(geoaddress, displayaddress) {
// Error checking removed
geocoder.getLatLng(
geoaddress,
function(point) {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(displayaddress);
}
);
}
function exampleUse() {
showAddress('123 Main St, My Town', 'My House');
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment