Switch XML value for another in google maps

Posted by JeffP on Stack Overflow See other posts from Stack Overflow or by JeffP
Published on 2013-10-29T21:51:36Z Indexed on 2013/10/29 21:53 UTC
Read the original article Hit count: 156

Filed under:
|
|

all thanks for taking a look.

Problem: Using Google maps I need to switch catid value to another value. How would I approach this and display it in a the window.

E.G

var catid = {
  2: {
    newcatid: 'london'
  },
  4: {
    newcatid: 'newyork'
  }
};




function load() {
      var map = new google.maps.Map(document.getElementById("map"), {
        center: new google.maps.LatLng(47.6145, -122.3418),
        zoom: 5,
        mapTypeId: 'roadmap'
      });
      var infoWindow = new google.maps.InfoWindow;

      // Change this depending on the name of your PHP file
      downloadUrl("index_xml.php", function(data) {
        var xml = data.responseXML;
        var markers = xml.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++) {
          var name = markers[i].getAttribute("title");
          var address = markers[i].getAttribute("address");
          var catid = markers[i].getAttribute("catid");
          var point = new google.maps.LatLng(
              parseFloat(markers[i].getAttribute("latitude")),
              parseFloat(markers[i].getAttribute("langtitude")));
          var html = "<b>" + name + "</b> <br/>" + address + "<br/>" + **catid** + "<br/> <a href='@'>Info</a>" ;

© Stack Overflow or respective owner

Related posts about Xml

Related posts about google