Saturday, September 13, 2008

Exporting from XAF Win app to Google Earth

In a previous post I build an example showing how to seamlessly integrate a XAF Web app with Google Maps, using the Google API and a custom ListEditor.

For a Winforms application I prefer to export the information to Google Earth using a KML file because it's easier to develop and it offers a much richer experience to the user. 

The sample I'm sharing today does the following: (can be downloaded here)
  • Like in the XAF Web sample, it geolocalizes a customer main address to get it's longitude and latitude. This information is updated and persisted to the database every time the customer is saved.
  • A ViewController called "GoogleEarthController" shows an action to export either All or Selected customers.
  • Using the free and powerful Google Earth KML API for .NET 2.0 (ge-kml) it creates a temporary KML including the information from the Customer object provided by its IPlacemark interface: coordinates, a Title and a HTMLDescription used to show the nice google earth information balloons.
  • Once the KML has been generated, the XAF Application automatically opens it using Google Earth. The exported customers appears in the "Places" section.


And that's all for this basic XAF to KML exportation sample. Feedback will be highly appreciated.



No comments: