Craig Hopson Posted December 4, 2012 Share Posted December 4, 2012 hi can some one check this syntax of this cos i'm missing something it just dont workThe JS downloadUrl("http://chsites.co.uk/track/inc/maploc.php?id='.$mapid.'&name='.$member['id'].'", function(data) {var xml = data.responseXML; var Center = xml.documentElement.getElementsByTagName("marker"); var map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng( parseFloat(Center.getAttribute("lat")), parseFloat(Center.getAttribute("lon"))), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL } });} function downloadUrl(url, callback) { var request = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest; request.onreadystatechange = function() { if (request.readyState == 4) { request.onreadystatechange = doNothing; callback(request, request.status); } }; request.open("GET", url, true); request.send(null); } The XML <markers> <marker lat="51.5589355" lon="0.1463353" speed="1.255" time="17:12:39 - 2012/12/04"/></markers> Link to comment Share on other sites More sharing options...
justsomeguy Posted December 4, 2012 Share Posted December 4, 2012 If there's a syntax error your browser will tell you that, are you checking the console? Link to comment Share on other sites More sharing options...
thescientist Posted December 5, 2012 Share Posted December 5, 2012 (edited) how doesn't it work? What debugging have you done to try and pinpoint the cause of your problem? At least give us something to work with when you present your problems. Edited December 5, 2012 by thescientist Link to comment Share on other sites More sharing options...
Craig Hopson Posted December 5, 2012 Author Share Posted December 5, 2012 sorry looking back i was vague. OK a simple Google map API V3 would be HTML <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC9drFQnsmuob_bO9wFITHv-5K2pM-lgD0&sensor=false"></script> <script type="text/javascript">var map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng(LATITUDE,LONGITUDE), //THIS MUST BE A POSITION (you understand) zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL } });</script> OK this will show a map with the center of the map whatever LATITUDE,LONGITUDE you put in i wish to update the map center every 10 seconds with new coordinates (the script in first post) Link to comment Share on other sites More sharing options...
justsomeguy Posted December 5, 2012 Share Posted December 5, 2012 What about your code isn't working? Is it parsing the XML and can you get the correct latitude and longitude? Do you want to build a new map every time or update an existing one? Link to comment Share on other sites More sharing options...
Craig Hopson Posted December 5, 2012 Author Share Posted December 5, 2012 just update the existing one i thing i've found something its panTo() i thing i need to use this Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now