开发者

How would I display Pushpins Based on this KML/XML

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜