Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/365.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
Java 使用现有谷歌地图API的Android MapView_Java_Android_Google Maps_Maps_Android Mapview - Fatal编程技术网

Java 使用现有谷歌地图API的Android MapView

Java 使用现有谷歌地图API的Android MapView,java,android,google-maps,maps,android-mapview,Java,Android,Google Maps,Maps,Android Mapview,我搜索了SO和谷歌,但没有找到任何答案 我被传递了以下数据,需要在android中显示。 目前,我在webview中显示它,其中IFrame是它的唯一元素。但我真的需要在地图视图中显示它。我已经创建了一个地图视图并使其正常工作。我现在需要在MapView中显示数据,如上面的url所示 虽然我可以看到lat/long值,但是否可以获取自定义地图并将其添加到MapView中?尝试从URL获取KML文件,msid将匹配 指向KML文件的链接将是: 您必须解析KML才能获得位置 <?xml v

我搜索了SO和谷歌,但没有找到任何答案

我被传递了以下数据,需要在android中显示。

目前,我在webview中显示它,其中IFrame是它的唯一元素。但我真的需要在地图视图中显示它。我已经创建了一个地图视图并使其正常工作。我现在需要在MapView中显示数据,如上面的url所示


虽然我可以看到lat/long值,但是否可以获取自定义地图并将其添加到MapView中?

尝试从URL获取KML文件,msid将匹配

指向KML文件的链接将是:

您必须解析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>

无标题
http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png
http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png
http://maps.gstatic.com/mapfiles/ms2/micons/blue-dot.png
八角形
这是八角形的描述]]>
#样式3
-2.081995,52.812881,0.000000
体育中心
这是运动中心的说明]]>
#样式2
-2.080439,52.812202,0.000000
布莱克希斯巷
#样式1
-2.072489,52.813522,0.000000
我想这会让你从URL获得位置,但我不知道如何轻松定制android地图

更新:


解析KML文件,stackoverflow链接:

从链接中,我可以看到您有一个流量层和3个点,在某些位置有一个自定义pin。那么你是在问如何在地图视图中做到这一点吗?@krishnakanthc我知道我可以在地图视图中使用叠加和添加地质点来做到这一点。我想要实现的是,只要给定这个URL,我就可以提取数据并将其放在mapview上,或者理想情况下,将URL传递给mapview并让它计算出来。我目前的工作是以该URL作为数据启动Google地图应用程序。但是,我确实需要它位于一个应用程序中,因此尝试使用地图视图,但不知道如何从URL中获取自定义地图数据。使用KML文件,我将解析文件中的每个节点并显示它们。干杯