I have followed the tutorial Using PHP/MySQL with Google Maps and
successfully created a map and markers.  I have modified the sql
select statement in phpsqlajax_genxml3.php to select only one record
and I would like to center and zoom the map to street level for that
point.
/*code
  function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(54.222385,-4.697412), 15);

        // Change this depending on the name of your PHP file
        GDownloadUrl("phpsqlajax_genxml3.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName
("marker");
          for (var i = 0; i < markers.length; i++) {
            var name = markers[i].getAttribute("name");
            var address = markers[i].getAttribute("address");
            var type = markers[i].getAttribute("type");
            var point = new GLatLng(parseFloat(markers[i].getAttribute
("lat")),
                                    parseFloat(markers[i].getAttribute
("lng")));
            var marker = createMarker(point, name, address, type);
            map.addOverlay(marker);
          }
*/ code

My question is how would I replace the static lat,lng value in:-

 map.setCenter(new GLatLng(54.222385,-4.697412), 15);

with the parsed lat, lng values from the XML file which are being used
to set the point?

regards
Graham

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-api?hl=en.


Reply via email to