Yes, but I have to deletet from mysql too so...I have to memorize somehow
the marker which i deletet from the map in order to deletet from database.
So...i wan't to take the id of the marker or the latitude or longitude
when i clik on a marker.
So, I tried with this code, but it doesn't works:
var customIcons = {
restaurant: {
icon: 'http://google-maps-icons.googlecode.com/files/restaurant.png
'
},
visit_point: {
icon: 'http://google-maps-icons.googlecode.com/files/palace.png'
},
hotel: { icon: '
http://google-maps-icons.googlecode.com/files/hotel.png'},
coffee: { icon: '
http://google-maps-icons.googlecode.com/files/coffee.png'},
bathroom: { icon: '
http://google-maps-icons.googlecode.com/files/toilets.png'},
info_point: {icon: '
http://google-maps-icons.googlecode.com/files/info.png'},
police: { icon: '
http://google-maps-icons.googlecode.com/files/police.png'},
bus: { icon : 'http://google-maps-icons.googlecode.com/files/bus.png'
},
taxi: { icon: 'http://google-maps-icons.googlecode.com/files/taxi.png'
},
hospital: { icon: '
http://google-maps-icons.googlecode.com/files/hospital.png'}
};
var map;
function initialize() {
var mylatlng = new google.maps.LatLng(38.797896, -9.388701 );
var myOptions = {
zoom:15,
center: mylatlng,
mapTypeId: google.maps.MapTypeId.HYBRID
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var infoWindow = new google.maps.InfoWindow;
downloadUrl("xmloutdom1.php", function(data) {
var markers = data.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var type = markers[i].getAttribute("type");
var description = markers[i].getAttribute("description");
var picture= markers[i].getAttribute("picture");
var address = markers[i].getAttribute("address");
var link = markers[i].getAttribute("link");
var point = new
google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var html = '<div id="info"'+
'<h2> '+name+' </h2> '+
'<img src="images/'+ picture +'" alt=""/>'+
'<p>'+ description +' </p>'+
'<p> <a href="'+ link +'">'+ 'Link: '+name +' </a></p>'+
'<p>'+'Address:'+ address +'</p>' +
'</div>';
var icon = customIcons[type] || {};
var marker = new google.maps.Marker({
map: map,
position: point,
title:name,
icon: icon.icon
//,icon:customIcons[type]
//icon: "
http://google-maps-icons.googlecode.com/files/coffee.png"
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
google.maps.event.addListener(marker, 'click', function(event) {
InfoWindow.close();
marker.setMap(null);
var form=document.getElementById("delete_form");
var latf=form.elements[0];
latf.value=event.marker.latLng.lat();
var lngf=form.elements[1];
lngf.value=event.latLng.lng();
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
thnks!!
On Mon, Dec 6, 2010 at 4:16 AM, Luke Mahé <[email protected]> wrote:
> Hey,
>
> You need to call setMap(null) on the marker to remove it from a map,
> ie: marker.setMap(null);
>
> Hope this helps
>
> - Luke
>
>
> On Mon, Dec 6, 2010 at 12:34 PM, Blanaru Irina <[email protected]>wrote:
>
>> Hey everybody,
>>
>> How can I remove a marker from the map?
>> Thank you!!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Maps JavaScript API v3" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-maps-js-api-v3%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.