multiple markers on google maps from xml file

前端 未结 2 1439
别那么骄傲
别那么骄傲 2020-12-22 07:15

I am so close to get this working

My question is: how can i make the google maps read the data.xml file that is stored on my ftp server?

Th

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-22 07:42

    The latitude and longitude is stored as content of the lat/lng-childNodes of the marker's

    You may access the values via:

    var latlng = new google.maps.LatLng(parseFloat(markers[i]
                                                    .getElementsByTagName("lat")[0]
                                                      .firstChild.nodeValue),
                                        parseFloat(markers[i]
                                                    .getElementsByTagName("lng")[0]
                                                      .firstChild.nodeValue));
    

提交回复
热议问题