Friday, December 19, 2008

Android, Google Earth and KML routes

Whilst testing location based applications, the need to simulate routes is likely to appear.
This article shows you how to obtain KML routes using Google Earth, convert it to a suitable format to be loaded into Eclipse ADT plugin Emulator Control and be able to test location based applications.

Create the route
Using Google Earth, create the route using Directions.

Then right click on Route, at the end of the list of directions, and save it. Let's say, we save it as myroute.kmz.

Convert the route
To be used with the current version of Android ADT plugin (0.8.0) a slightly different format is needed as is not supported.
We have to convert the route to use multiple s.

The change is really simple and we could do it manually, but fortunately there's an application to automate this task.
ge2adt is hosted on Google Appengine and can be reached at
Use your Google identifier to access it (i.e.: you gmail account).

Unzip kmz, extract doc.kml, rename it, upload myroute.kml, convert it, and save the result as myroute-adt.kml.

Test my location
Using Eclipse Android DDMS perspective, under Emulator Control, load the converted KML file myroute-adt.kml.

Once the route is loaded, use you location based application or launch Maps, select My Location on the menu, press the play button on Emulator Control and you will be able to appreciate the map moving along the route.

Post a Comment