javascript - Automatic refresh of Google Maps Markers -
I hope you can help me with my following problem. I have been compromising this since the day, but it does not ...
I am writing a little web app based on the Google Maps API, on which I can mark my actual location on the map I am one such with the revised marker-symbol Everything works great so far. I get my geographic location through the HTML 5-Geolocation function and write values to my database database. In a different function (see below) I read this data, set the marker with my revised icons on the map.
Next I do not want to solve, automatically remove the marker after 40 minutes from the map for this, I created a separate table on my database which is filled with marker-information from the main table . It works by now, I solved it with php-script and cron-job. Then the entry is removed from the main table, what makes me mad, is to remove the marker after 40 minutes from the map. I tried several things, by creating arrays with the data of "to-to-table", I played with the setmap function of the Google Maps API, but I'm still on the line.
It reads data from the database I where my code and I'd set the marker on the map:
function markPolitesse () {var infoWindow_spotted = new google.maps. InfoWindow; downloadUrl ( "phpsqlajax_genxml2.php", function (data) {var xml = data.responseXML; var markers = xml.documentElement.getElementsByTagName ( "politesse_spotted"); I & lt; markers.length, (var i = 0 i ++) {var number = markers [i] .getAttribute ( "No."); var city = markers [i] .getAttribute ( "city"); var zipcode = markers [i] .getAttribute ( "ZIP"); var road markers = [i] .getAttribute ( "street"); var type = markers [i] .getAttribute ( "street"); var point = new google.maps.LatLng (parseFloat (marker [i] .getAttribute ( "lAT "), ParseFloat (Marker [i] .getAttribute (" LNG ")); Html =" & lt; p> "+ City +" & lt; / p & gt; & lt; br / & Gt; "+ zipcode +" & lt; / p & gt; & lt; br / & gt; "+ type +" & lt; / p & gt; & lt; br / & gt; "var marker = new google.maps.Marker ({map: map position: point, title number, icon Princess Image}); bind Infofndo (markers, map, Infovindo spots, HTML);}}); }
main- and "are off-table" following areas: number, city, zip code, street, streetnumber, coordinates_lat, coordinates_lng, time, date
I hope you will be impulsive, I will be grateful ...
Regards, Stephen
Store the marker outside the global variable / function, then do the following in your function:
marker.setMap (null); // Specify your new marker
Comments
Post a Comment