[Google Maps API v2] migrating from v2 to v3
Hi i have 1 question and a problem - PLEASE HELP
-- the load code below - should the 2 not be a 3?
<script type="text/javascript">
google.load("maps", "2",{"other_params":"sensor=true"});
my big problem - unable to add and delete markers on map with the old code though i have replaced the G with google.maps.
<script type="text/javascript">
var map = new google.maps.Map(document.getElementById("map"));
map.addControl(new google.maps.SmallMapControl());
map.addControl(new google.maps.MapTypeControl());
var homeIcon = new google.maps.Icon();
homeIcon.image = "http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=home|B6D4E8";
homeIcon.shadow = "http://chart.apis.google.com/chart?chst=d_map_pin_shadow";
homeIcon.iconSize = new google.maps.Size(24, 40);
homeIcon.shadowSize = new google.maps.Size(44, 40);
homeIcon.iconAnchor = new google.maps.Point(12, 40);
homeIcon.infoWindowAnchor = new google.maps.Point(12, 2);
markerOptions = { icon:homeIcon };
var lat = document.getElementById("latitude").value;
var lon = document.getElementById("longitude").value;
if (lat == 0 || lon == 0)
{
map.centerAndZoom(new google.maps.Point(-9.3603515625,38.777640223073), 8);
} else
{
var house = new google.maps.Point(lon,lat);
map.centerAndZoom(house, 8);
var marker = new google.maps.Marker(house, markerOptions);
map.addOverlay(marker);
}
google.maps.event.addListener(map, 'click', function(overlay, point) {
if (overlay) {
map.removeOverlay(overlay);
document.getElementById("latitude").value=0;
document.getElementById("longitude").value=0;
} else if (point) {
map.recenterOrPanToLatLng(point);
var marker = new google.maps.Marker(point, markerOptions);
map.addOverlay(marker);
}
});
google.maps.event.addListener(map, 'click', function(overlay, point) {
document.getElementById("latitude").value=point.y;
document.getElementById("longitude").value=point.x;
});
</script>
Thanks
Melanie
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home