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
Google maps KML轨道,每个点有额外数据_Google Maps_Kml - Fatal编程技术网

Google maps KML轨道,每个点有额外数据

Google maps KML轨道,每个点有额外数据,google-maps,kml,Google Maps,Kml,我在哪里可以找到一个kml文件的示例,它有一个轨迹,并且每个点都有一个与之相关的特殊数据 比如: <Placemark> <Point> <name>Spot 2</name> <description>12 May 2011, 2.3g nugget</description> <coordinates>144.253,-36.6632,0</coo

我在哪里可以找到一个kml文件的示例,它有一个轨迹,并且每个点都有一个与之相关的特殊数据

比如:

<Placemark>
    <Point>
        <name>Spot 2</name>
        <description>12 May 2011, 2.3g nugget</description>
        <coordinates>144.253,-36.6632,0</coordinates>
    </Point>
    <Point>
        <name>Spot 3</name>
        <description>6 June 2011, 5.6g nugget</description>
        <coordinates>144.2891,-36.6894,0</coordinates>
    </Point>
    <Point>
        <name>Spot 5</name>
        <description>28 June 2011, 4.1g nugget</description>
        <coordinates>144.2344,-36.6907,0</coordinates>
    </Point>
</Placemark>

现场2
2011年5月12日,2.3g nugget
144.253,-36.6632,0
第三点
2011年6月6日,5.6克金块
144.2891,-36.6894,0
第五点
2011年6月28日,4.1g金块
144.2344,-36.6907,0
(以上示例的问题是,这些点与google maps的一个轨迹不相关)

您可以使用
中存储与每个点对应的附加数据

如果您需要在每个坐标处提供实际文本数据,我建议首先创建一个
,然后为轨迹中的每个坐标创建一个带有
标记的地点标记

此外,您的KML不正确。
标记必须位于
的外部,位于
的内部。此外,每个Placemark只能有一个名称和一个描述,因此如果需要单独的描述和名称,则需要将KML分解为多个Placemark

应该是这样的:

<Placemark>
  <name>Spot 2</name>
  <description>12 May 2011, 2.3g nugget</description>
  <Point>
    <coordinates>144.253,-36.6632,0</coordinates>
  </Point>
</Placemark>

<Placemark>
  <name>Spot 3</name>
  <description>6 June 2011, 5.6g nugget</description>
  <Point>
    <coordinates>144.2891,-36.6894,0</coordinates>
  </Point>
</Placemark>

<Placemark>
  <name>Spot 5</name>
  <description>28 June 2011, 4.1g nugget</description>
  <Point>    
    <coordinates>144.2344,-36.6907,0</coordinates>
  </Point>
</Placemark>

现场2
2011年5月12日,2.3g nugget
144.253,-36.6632,0
第三点
2011年6月6日,5.6克金块
144.2891,-36.6894,0
第五点
2011年6月28日,4.1g金块
144.2344,-36.6907,0

KML在我看来无效,你看了吗?我看了,但我找不到我需要的东西-一条轨迹,对于轨迹中的每个点,我可以添加更多数据(如描述),这是我能想到的在KML中执行此操作的唯一方法(其他人可能有更好的建议)@geocodezip-您能提供源文件吗?它的位置在提供的链接中。