开发者

How to prepare KML file for Android Emulator Control?

开发者 https://www.devze.com 2022-12-17 11:35 出处:网络
I am trying to test my application with location information. You know the Emulator Control has an ability to load from KML file. (Eclipse -> DDMS -> Emulator Control -> Location Controls -> KML -> Lo

I am trying to test my application with location information. You know the Emulator Control has an ability to load from KML file. (Eclipse -> DDMS -> Emulator Control -> Location Controls -> KML -> Load KML...) I've prepared KML file using Google earth application with its "Add path". Then saved it by .kml extension and load it on the Eclipse. Eclipse didn't load this KML file.

How to prepare KML file for Androi开发者_C百科d Emulator Control?


I've found solution : KML format is :

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.x">
<Placemark>
    <name>1</name>
        <Point><coordinates>-109.0450005395891,33.39487928579279,0</coordinates></Point>
</Placemark>
</kml>


The KML format that's accepted by ADT (0.8.x) differs from the Google Earth (or even Google Tracks) format.

Convert the original KML file at http://ge2adt.appspot.com/, use your Google account to login.

You can now try to open the file in the emulator control. I still couldn't open the KML file in the emulator. Open the KML file and remove the 'Document' element, don't delete the 'Placemark' elements. Also check if there multiple KML definitions ('kml' element). I had two definitions with only one placemark, and one correct definition with multiple placemarks. Delete the definitions with only one placemark.


Just tested this, and found actually the only thing you need to change to get the ADT to accept your KML file is to change the namespace to http://earth.google.com/kml/2.x.

You'd think someone at Google would have sorted this out by now...


The KML file must be a 3D file - some GIS tools (e.g. QGIS) don't put the Z value in the output if it is not present in your input data. A simple search and replace to add ,0 before each closing </coordinate> tag will solve this problem.

0

精彩评论

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

关注公众号