locked
Plotting from XML

    Question

  • HI, Im trying to learn how to plot push pins from data read from an XML file. I came across this link http://msdn2.microsoft.com/en-us/library/aa907682.aspx and altough I know what is going on I cant figure how to change it to work with my XML file. I was wondering if any of you guys can help me out or know of any tutorials that would be of help to me.  My XML file looks like this(it is generated from metadata extracted from some of my images)

    <?xml version="1.0" encoding="UTF-8"?>
    <java version="1.5.0_06" class="java.beans.XMLDecoder">
     <object class="java.util.ArrayList">
      <void method="add">
       <object class="processPhoto.Photo">
        <double>137.123134234</double>
        <double>37.767698909</double>
        <string>No Date Present</string>
        <string>No Time Present</string>
        <string>C:\Temp\Images\Holiday-0234.jpg</string>
        <string>C:\Documents and Settings\Desktop\VEPlot\Thumbnails\Holiday-0234.jpg</string>
        <object class="java.util.Date">
         <long>0</long>
        </object>
        <string>Holiday-0234.jpg</string>
        <string>C:\Temp\Images</string>
        <string>-1</string>
        <string>-1</string>
       </object>
      </void>
      <void method="add">
       <object class="processPhoto.Photo">
        <double>137.31469444444446</double>
        <double>36.178916666666666</double>
        <string>13-Oct-2002</string>
        <string>10:50:01</string>
        <string>C:\Temp\Images\images.jpg</string>
        <string>C:\Documents and Settings\Desktop\VEPlot\Thumbnails\images.jpg</string>
        <object class="java.util.Date">
         <long>1034502601000</long>
        </object>
        <string>images.jpg</string>
        <string>C:\Temp\Images</string>
        <string>180</string>
        <string>180</string>
       </object>
      </void>
     </object>
    </java>
    Tuesday, April 15, 2008 1:08 AM

Answers

  • To further expand, here is a sample of the geoRSS format:

    Code Snippet

    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:mappoint="http://virtualearth.msn.com/apis/annotate#">
        <channel>
            <title>Title of geoRSS Content</title>
            <link/>
            <description>Description of Content</description>
            <mappointIntlCode>cht</mappointIntlCode>
            <item>
                <title>entity title</title>
                <description>entity description</description>
                <georss:point>43.6425442701129 -79.386982174081</georss:point>
                <mappoint:icon>URL to an icon</mappoint.icon>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description</description>
                <geo:lat>43.6303867857264</geo:lat>
                <geo:long>-79.424808885745</geo:long>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description - line needs a min of 2 pairs of points</description>
                <georss:line>43.6303867857264 -79.424808885745 43.6425442701129 -79.386982174081</georss:line>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description - polygon needs a min of 3 pairs of points</description>
                <georss:polygon>43.6303867857264 -79.424808885745 43.6425442701129 -79.386982174081 43.8225442701129 -79.266982174081</georss:polygon>
            </item>
        </channel>
    </rss>


    Tuesday, April 15, 2008 4:40 AM

All replies

  • Virtual Earth can import GeoRSS and KML format xml files. You will have to either convert your xml file to one of those formats or create an algorithm to parse your xml file and plot the points on the map. Virtual Earths support of KMl is limited at this time, GeoRSS would be your best choice of format.
    Tuesday, April 15, 2008 1:47 AM
  • To further expand, here is a sample of the geoRSS format:

    Code Snippet

    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:mappoint="http://virtualearth.msn.com/apis/annotate#">
        <channel>
            <title>Title of geoRSS Content</title>
            <link/>
            <description>Description of Content</description>
            <mappointIntlCode>cht</mappointIntlCode>
            <item>
                <title>entity title</title>
                <description>entity description</description>
                <georss:point>43.6425442701129 -79.386982174081</georss:point>
                <mappoint:icon>URL to an icon</mappoint.icon>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description</description>
                <geo:lat>43.6303867857264</geo:lat>
                <geo:long>-79.424808885745</geo:long>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description - line needs a min of 2 pairs of points</description>
                <georss:line>43.6303867857264 -79.424808885745 43.6425442701129 -79.386982174081</georss:line>
            </item>
            <item>
                <title>entity title</title>
                <description>entity description - polygon needs a min of 3 pairs of points</description>
                <georss:polygon>43.6303867857264 -79.424808885745 43.6425442701129 -79.386982174081 43.8225442701129 -79.266982174081</georss:polygon>
            </item>
        </channel>
    </rss>


    Tuesday, April 15, 2008 4:40 AM
  • Thanks for the reply , Im not sure if I fully understand you, is there enough in my file to plot to Virtual Earth
    <void method="add">
       <object class="processPhoto.Photo">
        <double>137.31469444444446</double>
        <double>36.178916666666666</double>

    The void method add part is where new file info is started and the doubles refer to latitude and longitude. So are you saying I need some type of loop in my javascript that will find where the relevent info is?
    Tuesday, April 15, 2008 8:53 AM