2

我有一组带有时间戳的 GPS 数据点,我用这些数据点来创建一个人沿路径运动的动画。GPS 数据还有一个精度数字(以米为单位),我想使用图标大小在地图上表示。我想让图标是一个以人的纬度/经度为中心的圆圈,半径等于 GPS 测量的精度。

我搜索了论坛/谷歌,但找不到以物理距离指定图标大小的方法。有没有办法做到这一点?我已经阅读了<scale>允许您调整图标大小的属性,但对我来说,如何计算正确的比例数字以对应于地图上的 10 米并不明显。有没有人有创建特定物理尺寸图标的经验?

4

2 回答 2

1

图标大小是设置像素数。

另一种方法是在您的 kml 中使用模型

https://developers.google.com/kml/documentation/kmlreference#model

这比计算你的 lon lats 的计算强度要​​小

用 Sketchup 创建一个简单的尺寸比例模式,一个直径为 1 米的圆柱体

你可以使用

 <Scale> 
    <x>1</x>                
    <y>1</y>               
    <z>1</z>               
  </Scale>

将 x 和 y 设置为准确度

一个例子 来自 Google 地球的屏幕截图

公里:

<?xml version="1.0" encoding="utf-16"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
  <Document>
    <name>TestScaleSize</name> 
      <name>PathPoints</name> 
      <Placemark>
        <name>Point1</name>
        <TimeStamp> <when>2012-06-20T12:00</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26400</latitude> <altitude>0</altitude></Location>
           <Scale><x>8</x><y>8</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point2</name>
        <TimeStamp> <when>2012-06-20T12:01</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26405</latitude> <altitude>0</altitude></Location>
           <Scale><x>5</x><y>5</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point3</name>
        <TimeStamp> <when>2012-06-20T12:02</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26410</latitude> <altitude>0</altitude></Location>
           <Scale><x>4</x><y>4</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point4</name>
        <TimeStamp> <when>2012-06-20T12:03</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26415</latitude> <altitude>0</altitude></Location>
           <Scale><x>3</x><y>3</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point5</name>
        <TimeStamp> <when>2012-06-20T12:04</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26420</latitude> <altitude>0</altitude></Location>
           <Scale><x>2</x><y>2</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point6</name>
        <TimeStamp> <when>2012-06-20T12:05</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26425</latitude> <altitude>0</altitude></Location>
           <Scale><x>1</x><y>1</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
       <Placemark>
        <name>Point7</name>
        <TimeStamp> <when>2012-06-20T12:06</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26430</latitude> <altitude>0</altitude></Location>
           <Scale><x>1</x><y>1</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point8</name>
        <TimeStamp> <when>2012-06-20T12:07</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26435</latitude> <altitude>0</altitude></Location>
           <Scale><x>3</x><y>3</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point9</name>
        <TimeStamp> <when>2012-06-20T12:08</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26440</latitude> <altitude>0</altitude></Location>
           <Scale><x>1</x><y>1</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
      <Placemark>
        <name>Point10</name>
        <TimeStamp> <when>2012-06-20T12:09</when></TimeStamp>
        <Model>
          <altitudeMode>relativeToGround</altitudeMode>
          <Location><longitude>-123.145702</longitude><latitude> 49.26445</latitude> <altitude>0</altitude></Location>
           <Scale><x>1</x><y>1</y><z>1</z></Scale>
          <Link><href>scaleIcon.dae</href></Link>
        </Model>
      </Placemark>
  </Document>
</kml>

模型的 xml 如下将其保存为“scaleIcon.dae”并将两者放在同一个文件夹中,

![<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
    <asset>
        <contributor>
            <authoring_tool>Google SketchUp 8.0.11752</authoring_tool>
        </contributor>
        <created>2012-06-21T02:47:22Z</created>
        <modified>2012-06-21T02:47:22Z</modified>
        <unit meter="0.02539999969303608" name="inch" />
        <up_axis>Z_UP</up_axis>
    </asset>
    <library_visual_scenes>
        <visual_scene id="ID1">
            <node name="SketchUp">
                <instance_geometry url="#ID2">
                    <bind_material>
                        <technique_common>
                            <instance_material symbol="Material2" target="#ID3">
                                <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD" input_set="0" />
                            </instance_material>
                        </technique_common>
                    </bind_material>
                </instance_geometry>
            </node>
        </visual_scene>
    </library_visual_scenes>
    <library_geometries>
        <geometry id="ID2">
            <mesh>
                <source id="ID5">
                    <float_array id="ID8" count="288">-38.02857583815229 10.18972618513862 0 -38.0285758381523 -10.1897261851386 0 -39.37007874015748 4.821444091131312e-015 0 -34.09548833797003 -19.68503937007873 0 -34.09548833797002 19.68503937007876 0 -27.8388496530137 -27.83884965301367 0 -27.83884965301368 27.83884965301369 0 -19.68503937007876 -34.09548833797002 0 -19.68503937007873 34.09548833797003 0 -10.18972618513864 -38.02857583815229 0 -10.18972618513861 38.0285758381523 0 -7.232166136696968e-015 -39.37007874015748 0 2.410722045565656e-015 39.37007874015748 0 10.1897261851386 -38.0285758381523 0 10.18972618513862 38.02857583815229 0 19.68503937007872 -34.09548833797004 0 19.68503937007874 34.09548833797003 0 27.83884965301368 -27.83884965301369 0 27.83884965301369 27.83884965301368 0 34.09548833797002 -19.68503937007876 0 34.09548833797003 19.68503937007874 0 38.02857583815229 -10.18972618513864 0 38.0285758381523 10.18972618513861 0 39.37007874015748 0 0 -27.83884965301368 27.83884965301369 39.37007874015748 -19.68503937007873 34.09548833797003 0 -27.83884965301368 27.83884965301369 0 -19.68503937007873 34.09548833797003 39.37007874015748 -10.18972618513861 38.0285758381523 0 -10.18972618513861 38.0285758381523 39.37007874015748 2.410722045565656e-015 39.37007874015748 0 2.410722045565656e-015 39.37007874015748 39.37007874015748 10.18972618513862 38.02857583815229 0 10.18972618513862 38.02857583815229 39.37007874015748 19.68503937007874 34.09548833797003 0 19.68503937007874 34.09548833797003 39.37007874015748 27.83884965301369 27.83884965301368 0 27.83884965301369 27.83884965301368 39.37007874015748 34.09548833797003 19.68503937007874 39.37007874015748 34.09548833797003 19.68503937007874 0 38.0285758381523 10.18972618513861 39.37007874015748 38.0285758381523 10.18972618513861 0 39.37007874015748 0 39.37007874015748 39.37007874015748 0 0 38.02857583815229 -10.18972618513864 39.37007874015748 38.02857583815229 -10.18972618513864 0 34.09548833797002 -19.68503937007876 39.37007874015748 34.09548833797002 -19.68503937007876 0 27.83884965301368 -27.83884965301369 39.37007874015748 27.83884965301368 -27.83884965301369 0 19.68503937007872 -34.09548833797004 0 19.68503937007872 -34.09548833797004 39.37007874015748 10.1897261851386 -38.0285758381523 0 10.1897261851386 -38.0285758381523 39.37007874015748 -7.232166136696968e-015 -39.37007874015748 0 -7.232166136696968e-015 -39.37007874015748 39.37007874015748 -10.18972618513864 -38.02857583815229 0 -10.18972618513864 -38.02857583815229 39.37007874015748 -19.68503937007876 -34.09548833797002 0 -19.68503937007876 -34.09548833797002 39.37007874015748 -27.8388496530137 -27.83884965301367 0 -27.8388496530137 -27.83884965301367 39.37007874015748 -34.09548833797003 -19.68503937007873 39.37007874015748 -34.09548833797003 -19.68503937007873 0 -38.0285758381523 -10.1897261851386 39.37007874015748 -38.0285758381523 -10.1897261851386 0 -39.37007874015748 4.821444091131312e-015 39.37007874015748 -39.37007874015748 4.821444091131312e-015 0 -38.02857583815229 10.18972618513862 39.37007874015748 -38.02857583815229 10.18972618513862 0 -34.09548833797002 19.68503937007876 39.37007874015748 -34.09548833797002 19.68503937007876 0 -38.0285758381523 -10.1897261851386 39.37007874015748 -38.02857583815229 10.18972618513862 39.37007874015748 -39.37007874015748 4.821444091131312e-015 39.37007874015748 -34.09548833797003 -19.68503937007873 39.37007874015748 -34.09548833797002 19.68503937007876 39.37007874015748 -27.8388496530137 -27.83884965301367 39.37007874015748 -27.83884965301368 27.83884965301369 39.37007874015748 -19.68503937007876 -34.09548833797002 39.37007874015748 -19.68503937007873 34.09548833797003 39.37007874015748 -10.18972618513864 -38.02857583815229 39.37007874015748 -10.18972618513861 38.0285758381523 39.37007874015748 -7.232166136696968e-015 -39.37007874015748 39.37007874015748 2.410722045565656e-015 39.37007874015748 39.37007874015748 10.1897261851386 -38.0285758381523 39.37007874015748 10.18972618513862 38.02857583815229 39.37007874015748 19.68503937007872 -34.09548833797004 39.37007874015748 19.68503937007874 34.09548833797003 39.37007874015748 27.83884965301368 -27.83884965301369 39.37007874015748 27.83884965301369 27.83884965301368 39.37007874015748 34.09548833797002 -19.68503937007876 39.37007874015748 34.09548833797003 19.68503937007874 39.37007874015748 38.02857583815229 -10.18972618513864 39.37007874015748 38.0285758381523 10.18972618513861 39.37007874015748 39.37007874015748 0 39.37007874015748</float_array>
                    <technique_common>
                        <accessor count="96" source="#ID8" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <source id="ID6">
                    <float_array id="ID9" count="288">0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 -1 -0.7071067811865475 0.7071067811865476 0 -0.4999999999999999 0.8660254037844387 0 -0.7071067811865475 0.7071067811865476 0 -0.4999999999999999 0.8660254037844387 0 -0.2588190451025206 0.9659258262890684 0 -0.2588190451025206 0.9659258262890684 0 2.673332968694072e-016 1 0 2.673332968694072e-016 1 0 0.2588190451025209 0.9659258262890682 0 0.2588190451025209 0.9659258262890682 0 0.5 0.8660254037844386 0 0.5 0.8660254037844386 0 0.7071067811865475 0.7071067811865476 0 0.7071067811865475 0.7071067811865476 0 0.8660254037844387 0.5 0 0.8660254037844387 0.5 0 0.9659258262890684 0.2588190451025206 0 0.9659258262890684 0.2588190451025206 0 1 -4.901110442605798e-016 0 1 -4.901110442605798e-016 0 0.9659258262890682 -0.2588190451025212 0 0.9659258262890682 -0.2588190451025212 0 0.8660254037844384 -0.5000000000000004 0 0.8660254037844384 -0.5000000000000004 0 0.7071067811865471 -0.707106781186548 0 0.7071067811865471 -0.707106781186548 0 0.4999999999999995 -0.8660254037844389 0 0.4999999999999995 -0.8660254037844389 0 0.2588190451025204 -0.9659258262890684 0 0.2588190451025204 -0.9659258262890684 0 -4.72288824469286e-016 -1 0 -4.72288824469286e-016 -1 0 -0.2588190451025212 -0.9659258262890682 0 -0.2588190451025212 -0.9659258262890682 0 -0.5000000000000004 -0.8660254037844384 0 -0.5000000000000004 -0.8660254037844384 0 -0.7071067811865479 -0.7071067811865471 0 -0.7071067811865479 -0.7071067811865471 0 -0.8660254037844388 -0.4999999999999998 0 -0.8660254037844388 -0.4999999999999998 0 -0.9659258262890684 -0.2588190451025205 0 -0.9659258262890684 -0.2588190451025205 0 -1 2.316888572868195e-016 0 -1 2.316888572868195e-016 0 -0.9659258262890682 0.258819045102521 0 -0.9659258262890682 0.258819045102521 0 -0.8660254037844386 0.5000000000000001 0 -0.8660254037844386 0.5000000000000001 0 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1 -0 -0 1</float_array>
                    <technique_common>
                        <accessor count="96" source="#ID9" stride="3">
                            <param name="X" type="float" />
                            <param name="Y" type="float" />
                            <param name="Z" type="float" />
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="ID7">
                    <input semantic="POSITION" source="#ID5" />
                    <input semantic="NORMAL" source="#ID6" />
                </vertices>
                <triangles count="92" material="Material2">
                    <input offset="0" semantic="VERTEX" source="#ID7" />
                    <p>0 1 2 1 0 3 3 0 4 3 4 5 5 4 6 5 6 7 7 6 8 7 8 9 9 8 10 9 10 11 11 10 12 11 12 13 13 12 14 13 14 15 15 14 16 15 16 17 17 16 18 17 18 19 19 18 20 19 20 21 21 20 22 21 22 23 24 25 26 25 24 27 27 28 25 28 27 29 29 30 28 30 29 31 31 32 30 32 31 33 33 34 32 34 33 35 35 36 34 36 35 37 36 38 39 38 36 37 39 40 41 40 39 38 41 42 43 42 41 40 43 44 45 44 43 42 45 46 47 46 45 44 47 48 49 48 47 46 48 50 49 50 48 51 51 52 50 52 51 53 53 54 52 54 53 55 55 56 54 56 55 57 57 58 56 58 57 59 59 60 58 60 59 61 62 60 61 60 62 63 64 63 62 63 64 65 66 65 64 65 66 67 68 67 66 67 68 69 70 69 68 69 70 71 24 71 70 71 24 26 72 73 74 73 72 75 73 75 76 76 75 77 76 77 78 78 77 79 78 79 80 80 79 81 80 81 82 82 81 83 82 83 84 84 83 85 84 85 86 86 85 87 86 87 88 88 87 89 88 89 90 90 89 91 90 91 92 92 91 93 92 93 94 94 93 95</p>
                </triangles>
            </mesh>
        </geometry>
    </library_geometries>
    <library_materials>
        <material id="ID3" name="Color_A01_">
            <instance_effect url="#ID4" />
        </material>
    </library_materials>
    <library_effects>
        <effect id="ID4">
            <profile_COMMON>
                <technique sid="COMMON">
                    <lambert>
                        <diffuse>
                            <color>1 0 0 1</color>
                        </diffuse>
                    </lambert>
                </technique>
            </profile_COMMON>
        </effect>
    </library_effects>
    <scene>
        <instance_visual_scene url="#ID1" />
    </scene>
</COLLADA>][1]
于 2012-06-21T05:22:46.340 回答
0

经过一番搜索,我找到了一种方法,虽然不是用图标。我想我会分享以防其他人需要做类似的事情。据我所知,没有办法将图标设置为特定大小(物理距离,而不是像素),但您可以使用<Polygon>标签绘制具有所需物理半径的自己的圆圈。

计算圆半径上每个点的经纬度并不是完全简单的,但我发现了这个很棒的 python 工具,它会<Polygon>根据中心的纬度/经度和以米为单位的半径为您生成代码:

http://code.google.com/p/kmlcircle/

于 2012-06-18T14:54:04.167 回答