尝试从 URL 获取 KML 文件,msid 将匹配。
https://maps.google.com/maps/ms?msid=214791092532835797516.0004bc20df4e3c6ddf92a&msa=0&ll=52.812827,-2.079865&spn=0.003761,0.011689
KML 文件的链接为:https ://maps.google.com/maps/ms?ie=UTF8&authuser=0&msa=0&output=kml&msid=214791092532835797516.0004bc20df4e3c6ddf92a
您必须解析 KML 以获取位置
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Untitled</name>
<description><![CDATA[]]></description>
<Style id="style3">
<IconStyle>
<Icon>
<href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="style2">
<IconStyle>
<Icon>
<href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<Style id="style1">
<IconStyle>
<Icon>
<href>http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>The Octagon</name>
<description><![CDATA[<div dir="ltr">This is the description for the octagon</div>]]></description>
<styleUrl>#style3</styleUrl>
<Point>
<coordinates>-2.081995,52.812881,0.000000</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Sports centre</name>
<description><![CDATA[<div dir="ltr">This is the description for the sports centre</div>]]></description>
<styleUrl>#style2</styleUrl>
<Point>
<coordinates>-2.080439,52.812202,0.000000</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Blackheath lane</name>
<description><![CDATA[]]></description>
<styleUrl>#style1</styleUrl>
<Point>
<coordinates>-2.072489,52.813522,0.000000</coordinates>
</Point>
</Placemark>
</Document>
</kml>
我想这会从 URL 中获取您的位置,但我不确定如何轻松自定义 android 地图。
更新:
解析 KML 文件,stackoverflow 链接: 如何使用 kml 文件在地图上绘制路径?