Google maps 在谷歌地图/地球中填充多边形

Google maps 在谷歌地图/地球中填充多边形,google-maps,google-maps-api-3,kml,google-earth,Google Maps,Google Maps Api 3,Kml,Google Earth,我的KML文件如下所示: <?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <Style id="s1"> <LineStyle> <color>7f0000ff</color> <width>4</w

我的KML文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <Style id="s1">
      <LineStyle>
        <color>7f0000ff</color>
        <width>4</width>
      </LineStyle>
      <PolyStyle>
        <color>7f0000ff</color>
        <colorMode>normal</colorMode>
        <fill>1</fill>
        <outline>1</outline>
      </PolyStyle>
    </Style>
    <name>All isolation countries</name>
    <description>All isolation countries</description>
    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Indonesia</name>
      <Polygon>
        <extrude>1</extrude>
        <altitudeMode>relativeToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>
        <innerBoundaryIs>
          <LinearRing>
            <coordinates>102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0</coordinates>
          </LinearRing>
        </innerBoundaryIs>
      </Polygon>
    </Placemark>
    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Ecuador</name>
      <Polygon>
        <extrude>1</extrude>
        <altitudeMode>relativeToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>
        <innerBoundaryIs>
          <LinearRing>
            <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
          </LinearRing>
        </innerBoundaryIs>
      </Polygon>
    </Placemark>

7f0000ff
4.
7f0000ff
典型的
1.
1.
所有孤立国家
所有孤立国家
#s1
印度尼西亚
1.
相对地
102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0
102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0
#s1
厄瓜多尔
1.
相对地
-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0
-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0

它在google earth和map中工作,但无论我尝试什么,多边形都不会填充。有没有办法填满它们?谢谢


Christian

出于某种原因,你的外边界和内边界是相同的。内部边界通常仅在有“圆环孔”的情况下使用,但在这种情况下,“孔”与多边形本身一样大,因此看起来像一个未填充的多边形。你需要摆脱“内在界限”。例如,在印度尼西亚多边形中,删除以下内容:

<innerBoundaryIs>
  <LinearRing>
    <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
  </LinearRing>
</innerBoundaryIs>

-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0
您还应该添加一个细分,因为这些是非常大的多边形,您希望它们跟随地球的曲率…即。在“多边形”之后使用“镶嵌”(1或0表示打开或关闭)。最后,您希望您的高度模式为“爬升到地面”

我想这就是你想要的:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <Style id="s1">
      <LineStyle>
        <color>7f0000ff</color>
        <width>4</width>
      </LineStyle>
      <PolyStyle>
        <color>7f0000ff</color>
        <colorMode>normal</colorMode>
        <fill>1</fill>
        <outline>1</outline>
      </PolyStyle>
    </Style>
    <name>All isolation countries</name>
    <description>All isolation countries</description>



    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Indonesia</name>
      <Polygon>
      <tessellate>1</tessellate>
        <extrude>1</extrude>
        <altitudeMode>clampedToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>

      </Polygon>
    </Placemark>
    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Ecuador</name>
      <Polygon>
      <tessellate>1</tessellate>
        <extrude>1</extrude>
        <altitudeMode>clampedToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>

      </Polygon>
    </Placemark>
    </Document>
    </kml>

7f0000ff
4.
7f0000ff
典型的
1.
1.
所有孤立国家
所有孤立国家
#s1
印度尼西亚
1.
1.
攀爬
102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0
#s1
厄瓜多尔
1.
1.
攀爬
-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0

由于某种原因,您的外部边界和内部边界是相同的。内部边界通常仅在有“圆环孔”的情况下使用,但在这种情况下,“孔”与多边形本身一样大,因此看起来像一个未填充的多边形。你需要摆脱“内在界限”。例如,在印度尼西亚多边形中,删除以下内容:

<innerBoundaryIs>
  <LinearRing>
    <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
  </LinearRing>
</innerBoundaryIs>

-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0
您还应该添加一个细分,因为这些是非常大的多边形,您希望它们跟随地球的曲率…即。在“多边形”之后使用“镶嵌”(1或0表示打开或关闭)。最后,您希望您的高度模式为“爬升到地面”

我想这就是你想要的:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <Style id="s1">
      <LineStyle>
        <color>7f0000ff</color>
        <width>4</width>
      </LineStyle>
      <PolyStyle>
        <color>7f0000ff</color>
        <colorMode>normal</colorMode>
        <fill>1</fill>
        <outline>1</outline>
      </PolyStyle>
    </Style>
    <name>All isolation countries</name>
    <description>All isolation countries</description>



    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Indonesia</name>
      <Polygon>
      <tessellate>1</tessellate>
        <extrude>1</extrude>
        <altitudeMode>clampedToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.448055028915405,0 102.0785980224609,1.485000014305115,0 101.9944000244141,1.600000023841858,0 102.0065994262695,1.619166970252991,0 102.4349975585938,1.527500033378601,0 102.4779968261719,1.502221941947937,0 102.4954986572266,1.436308026313782,0 102.504997253418,1.273888945579529,0 102.4918975830078,1.259721994400024,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>

      </Polygon>
    </Placemark>
    <Placemark>
      <styleUrl>#s1</styleUrl>
      <name>Ecuador</name>
      <Polygon>
      <tessellate>1</tessellate>
        <extrude>1</extrude>
        <altitudeMode>clampedToGround</altitudeMode>
        <outerBoundaryIs>
          <LinearRing>
            <coordinates>-90.61167907714844,-0.3755556046962738,0 -90.77166748046875,-0.344166785478592,0 -90.87222290039063,-0.2652778923511506,0 -90.79332733154297,-0.149444505572319,0 -90.77362060546876,-0.1550000011920929,0 -90.58556365966797,-0.2455555945634842,0 -90.55029296875,-0.3091666996479035,0 -90.61167907714844,-0.3755556046962738,0</coordinates>
          </LinearRing>
        </outerBoundaryIs>

      </Polygon>
    </Placemark>
    </Document>
    </kml>

7f0000ff
4.
7f0000ff
典型的
1.
1.
所有孤立国家
所有孤立国家
#s1
印度尼西亚
1.
1.
攀爬
102.4918975830078,1.259721994400024,0 102.3088989257813,1.420554995536804,0 102.1374969482422,1.4480550289154