Loading pushpins from an external XML file
I'm trying to build a solution that allows me to add a series of pushpins onto a Virtual Earth map. My ideal solution requires that I load in a number of pushpins from a external XML file.
I was excited to see VE's new support for content layers as it sounded exactly like what I was looking for, but after reading the SDK reference, it doesn't look like it's going to suit my needs. VECollection layers are not very usable since they can only be loaded from local.live.com. I've been playing around with the GeoRSS support and I find it really lacking too. The problem is VE's GeoRSS support is that it's just TOO simple (as least as far as I can tell). It does not support HTML code in the description so you are limited to simple popups that contain only text. Support for the GeoRSS <link> is limited to appearing as a series of dots (...), with no apparent way to re-style it.
By comparsion, Yahoo offers an amazing number of options (http://developer.yahoo.com/maps/georss/index.html)
I'd like to use Virtual Earth. Can someone point me to any solution examples where people have created a series of pushpin items from an external XML file?
i havent finished this yet, will do within the next week. but there should be enough to get you started. basically i use an external js library to read my xml (georss) file into a json object. then i can access the properties of each of the elements to draw them on the map.
the link should work now but may not in the future, apologies to those how try at a later date, will try and remember to update
rob
http://www.gisconsultancy.com/photomap/photomap.html
Hi John,
I have a background in GIS and don't consider myself a 'hot' web developer, i just have an interest and like to hack around. For example, playing around with this was the first time i'd used any sort of JSON, the main reason i did it was because in the past ive had problems with cross browser xml-dom-xpath interpretations. So i figured if i put the xml into javascript, i can access the json the same way in firefox or explorer.
Rob
DevMavrick wrote: |
| I struggled with this too for a while. You can add html to the description, you just have to format it a bit differently. You have to replace special characters with their encoded equivilents within your XML < = < > = > as in: <title>My Pushpin</title> <description> &l<a target=_blank href=dev.live.com$gt;Click Here</a> </description> <geo:lat>28.124302</geo:lat> <geo:long>-80.696847</geo:long> <<icon>Mypic.gif</icon> </item> I did this dynamically by creating a web service that writes the xml file and sends back the filename to the AJAX javascript call. It adds the GeoRSS Layer, then calls another web service that deletes the temp xml file. Doing it that way you can dynamically add information to each data element including having HTML in the description. You can also change the icon based on data. |
|
instead of adding a GeoRSS layer simply parse the XML file. and then add a pushpin depending on the xml file.
Isnt that easy? or i m missing the problem