Open local KML File in Google Maps on Android-ThrowExceptions

Exception or error:

I have loaded a KML file onto an Android device. What’s the easiest mechanism for loading an overlay of that KML file into Google Maps? I do not want to upload the KML file to the web but would rather open it locally.

How to solve:

To load kml into Google Maps on Android without writing an app, you can create a little html file somewhere with a geo-uri link to the kml file and then click on that link in any Android web browser.

For example: suppose your kml file is located in /sdcard/overlay.kml then you write a geo-uri link like this:

<head><title>Example KML link page using a geo-uri</title></head>
  <a href="geo:0,0?q=file:///sdcard/overlay.kml">overlay.kml</a>

Clicking on the link will launch Maps and then Maps will attempt to load and your kml.

(Obviously if your kml file is on a web server the file:// part can be replaced with
http:// servername)

Be warned however that the Android version of Maps does not appear to handle the same version/range of kml elements as the desktop version (or desktop Google Earth).


I cannot tell about older Android versions, but on Nexus 4 with Android 4.2.2 this is very easy:

  • Transfer the KML file to your Android device and store it on your SD card by any means (USB, eMail, PAW app,…)
  • Use some file manager app (e.g. Solid Explorer, Astro, …) to locate the file in the file system and click it.
  • Google Earth will pop up and the KML file will be displayed on top of the Earth satellite image.

In Earth you can also tap on any KML objects to display associated information (if any is stored in the KML file).


File KML = new File("/sdcard/doc.kml");
Intent i = getPackageManager().getLaunchIntentForPackage("");
i.setDataAndType(Uri.fromFile(KML), "xml");



Assuming you are OK to show your KML on OpenStreetMap instead of Google Maps, you can also use osmdroid + OSMBonusPack (

Depending on what you want to do:

  • You can just use the demo application “OSMNavigator” to load and display your KML file on the map (KML can be local or from a url).

  • Or you can use OSMBonusPack library in your application to display your KML content as you want.

Leave a Reply

Your email address will not be published. Required fields are marked *