开发者

Help to generate an option list dropdown (jump to) from an xml file for google maps

开发者 https://www.devze.com 2023-03-18 01:05 出处:网络
I have an xml file, which is pulled into a google map just fine. I would like to add a directions option to my map.

I have an xml file, which is pulled into a google map just fine.

I would like to add a directions option to my map.

In order to do this, I need a dropdown for all markers on the map.

开发者_运维技巧

A row of my xml looks like

<marker id="12" name="placename" category="11" lat="66.555488" 
        lng="5.238545" address1="property name" address2="roadname" 
        address3="town" address4="" county="some county" postcode="ab1 1ab"/>

So in my html on the page, I need to show

<option value="53.2,5.238545">placename</option> 

or

<option value="lat,lng">name</option> 

repeated for each entry in the XML.

How can I generate such a dropdown automatically from the xml file?


Parse your XML using PHP (or another programming language). If you do it with PHP you can use the SimpleXML library.

You could also do it with Javascript. I'm not sure what Javascript library does xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消