开发者

How would I display Pushpins Based on this KML/XML

开发者 https://www.devze.com 2023-04-05 13:07 出处:网络
I current have a KML File with each location written as below. <Placemark> <name>Placemark 1</name>

I current have a KML File with each location written as below.

  <Placemark>
    <name>Placemark 1</name>
    <description><!开发者_如何学Python[CDATA[]]></description>
    <styleUrl>#style6</styleUrl>
    <Point>
      <coordinates>174.732224,-36.931053,0.000000</coordinates>
    </Point>
  </Placemark>

I am looking for a way to bind the coordinates to Pushpins using datatemaplte binding and XML parsing.

I have seen quite a few other examples, but all using lat and long values, not a combined coordinates like above.

I assume the XAMl would be something like this.

<my:Pushpin Location="{Binding Location, Converter={...}}"
            Content="{Binding}" />

Does anyone have any idea how I would parse this KML correctly to bind the location?

This is for WIndows Phone 7

If you need clarification please let me know.


String.Split is your friend!

var geoData = coordinates.Split(',');
var latitude = double.Parse(geoData[0]);
var longitude = double.Parse(geoData[1]);
var altitude = double.Parse(geoData[2]);
0

精彩评论

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

关注公众号