我搜索了SO和Google但没有找到任何答案。
我正在传递以下数据,需要在android中显示它。 http://maps.google.com/maps/ms?msid=214791092532835797516.0004bc20df4e3c6ddf92a&msa=0&ll=52.812827,-2.079865&spn=0.003761,0.011689&
目前我将其显示在webview中,其中IFrame是唯一的元素。但我真的需要在MapView中显示它。我创建了一个MapView并使其正常工作。我现在需要在MapView中显示数据,如上面的url所示。
虽然我可以看到lat / long值,是否可以获取自定义地图,并将其添加到MapView中?
答案 0 :(得分:1)
尝试从URL获取KML文件,msid将匹配。
您必须解析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链接:How to draw a path on a map using kml file?