Android 从Google Maps API保存KMZ文件
我在Android开发中使用谷歌地图API;我的应用程序根据位置定位一组标记。Android 从Google Maps API保存KMZ文件,android,google-maps,Android,Google Maps,我在Android开发中使用谷歌地图API;我的应用程序根据位置定位一组标记。 因此,每秒钟它都会找到一个标记,在旅程结束时,我会有一组标记 我需要将所有这些标记导出到kmz文件,以便稍后使用google earth打开它们 有什么想法吗?KMZ只是压缩的KML格式,所以只需使用标记数据格式化String: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2">
因此,每秒钟它都会找到一个标记,在旅程结束时,我会有一组标记 我需要将所有这些标记导出到kmz文件,以便稍后使用google earth打开它们
有什么想法吗?KMZ只是压缩的KML格式,所以只需使用标记数据格式化
String
:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Document.kml</name>
<open>1</open>
<Style id="exampleStyleDocument">
<LabelStyle>
<color>ff0000cc</color>
</LabelStyle>
</Style>
<Placemark>
<name>Document Feature 1</name>
<styleUrl>#exampleStyleDocument</styleUrl>
<Point>
<coordinates>-122.371,37.816,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Document Feature 2</name>
<styleUrl>#exampleStyleDocument</styleUrl>
<Point>
<coordinates>-122.370,37.817,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
别忘了加上
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
到您的
AndroidManifest.xml
文件。请查看更新的答案。哇,这是一个非常详细的解释。谢谢
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>