KML 点无法显示在 Android Google 地图上
KML Points Can't Display on Android Google Map
我写了一个包含一些点和线的 .kml 文件,当导入到 Google 我的地图时,所有内容都会显示出来。但是,当在我的 Android 设备上的 Google 地图中查看时(Select 来自 Google 地图 - 更多设置 - 您的地点 - 地图),点根本不显示。 kml 文件有什么问题吗?如何在 Android 设备上查看点?
来自桌面和 Android 的 Google 地图的屏幕截图发布在下方。
KML on Google Map Desktop
KML on Google Map Android
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="raptor">
<name>Raptor.kml</name>
<visibility>1</visibility>
<open>1</open>
<Placemark id="start">
<name>Start</name>
<Point id="startpoint">
<coordinates>
0.16212,51.5454
</coordinates>
</Point>
</Placemark>
<Placemark id="target">
<name>Target</name>
<Point id="targetpoint">
<coordinates>
0.06146,51.5529
</coordinates>
</Point>
</Placemark>
<Placemark id="route">
<name>Route</name>
<LineString id="routelines">
<coordinates>
0.16212,51.5454
0.16619,51.5445
0.16553,51.5442
0.05228,51.5394
0.05113,51.5381
0.0589,51.5528
0.06146,51.5529
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
问题已解决。通过为点添加样式,它也可以在移动应用程序上正确显示。下面是添加样式和屏幕截图的修改后的代码。
Point on Google Map Android
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="raptor">
<name>points.kml</name>
<Style id="sn_blue-dot_copy3">
<IconStyle>
<Icon>
<href>http://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<visibility>1</visibility>
<open>1</open>
<Placemark id="start">
<name>Start</name>
<styleUrl>#sn_blue-dot_copy3</styleUrl>
<Point id="startpoint">
<coordinates>
0.16212,51.5454,0
</coordinates>
</Point>
</Placemark>
<Placemark id="target">
<name>Target</name>
<styleUrl>#sn_blue-dot_copy3</styleUrl>
<Point id="targetpoint">
<coordinates>
0.06146,51.5529,0
</coordinates>
</Point>
</Placemark>
<Placemark id="route">
<name>Route</name>
<LineString id="routelines">
<coordinates>
0.16212,51.5454
0.16619,51.5445
0.16553,51.5442
0.05228,51.5394
0.05113,51.5381
0.0589,51.5528
0.06146,51.5529
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
我写了一个包含一些点和线的 .kml 文件,当导入到 Google 我的地图时,所有内容都会显示出来。但是,当在我的 Android 设备上的 Google 地图中查看时(Select 来自 Google 地图 - 更多设置 - 您的地点 - 地图),点根本不显示。 kml 文件有什么问题吗?如何在 Android 设备上查看点?
来自桌面和 Android 的 Google 地图的屏幕截图发布在下方。 KML on Google Map Desktop KML on Google Map Android
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="raptor">
<name>Raptor.kml</name>
<visibility>1</visibility>
<open>1</open>
<Placemark id="start">
<name>Start</name>
<Point id="startpoint">
<coordinates>
0.16212,51.5454
</coordinates>
</Point>
</Placemark>
<Placemark id="target">
<name>Target</name>
<Point id="targetpoint">
<coordinates>
0.06146,51.5529
</coordinates>
</Point>
</Placemark>
<Placemark id="route">
<name>Route</name>
<LineString id="routelines">
<coordinates>
0.16212,51.5454
0.16619,51.5445
0.16553,51.5442
0.05228,51.5394
0.05113,51.5381
0.0589,51.5528
0.06146,51.5529
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>
问题已解决。通过为点添加样式,它也可以在移动应用程序上正确显示。下面是添加样式和屏幕截图的修改后的代码。 Point on Google Map Android
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="raptor">
<name>points.kml</name>
<Style id="sn_blue-dot_copy3">
<IconStyle>
<Icon>
<href>http://www.google.com/intl/en_us/mapfiles/ms/icons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<visibility>1</visibility>
<open>1</open>
<Placemark id="start">
<name>Start</name>
<styleUrl>#sn_blue-dot_copy3</styleUrl>
<Point id="startpoint">
<coordinates>
0.16212,51.5454,0
</coordinates>
</Point>
</Placemark>
<Placemark id="target">
<name>Target</name>
<styleUrl>#sn_blue-dot_copy3</styleUrl>
<Point id="targetpoint">
<coordinates>
0.06146,51.5529,0
</coordinates>
</Point>
</Placemark>
<Placemark id="route">
<name>Route</name>
<LineString id="routelines">
<coordinates>
0.16212,51.5454
0.16619,51.5445
0.16553,51.5442
0.05228,51.5394
0.05113,51.5381
0.0589,51.5528
0.06146,51.5529
</coordinates>
</LineString>
</Placemark>
</Document>
</kml>