Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
XamGeographicMap with POI or KML
posted

Hello.

Is there a possibility to  integrate generate POI and KML into the maps?

Example:

The app connects to a webservice and we get a KML file back.
How can I display this file in the control?

Parents
  • 34810
    Suggested Answer
    Offline posted

    Hello Jan,

    Thank you for your post.

    I have been investigating into this functionality you are looking to achieve, and after doing some research into KML, it appears that they are essentially just XML documents, and can be read into your application by using the XmlDocument class and its Load method. Each KML file that I had tested seemed to have a Placemark node, which had a Point node inside of it with the longitude and latitude points inside.

    Using this information, I would suggest that you create a recursive loop that starts from the first element in the XmlDocument.DocumentElement.ChildNodes collection, and loops through each node and its children to find a node that has the name "Placemark." From there, you can continue parsing the KML file to find the Point node and its corresponding coordinate node, and create a Point that has its X and Y properties set to the longitude and latitude coordinates, respectively.

    The XamGeographicMap supports a series type name GeographicSymbolSeries, which will draw a marker that you can write a template for at certain longitude and latitude points on the map. Using the procedure above, I would recommend that you create an IEnumerable<Point> and add each of the coordinate node points to this collection. Then, you can bind the GeographicSymbolSeries to this collection, and set its LongitudeMemberPath and LatitudeMemberPath to "X" and "Y", respectively to have your points drawn on the XamGeographicMap.

    I have attached a sample project to demonstrate the above. Please note that the bin -> Debug folder currently contains the KML file that the ViewModel class will load and recursively parse.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support

    XamGeographicMapKMLCase.zip
Reply Children