Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从Google Maps API保存KMZ文件_Android_Google Maps - Fatal编程技术网

Android 从Google Maps API保存KMZ文件

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">

我在Android开发中使用谷歌地图API;我的应用程序根据位置定位一组标记。
因此,每秒钟它都会找到一个标记,在旅程结束时,我会有一组标记

我需要将所有这些标记导出到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"/>