需要帮助查找特定邮政编码的KML数据

时间:2012-12-18 18:58:43

标签: geocoding kml zipcode

我正在使用新泽西邮政编码制作热图,但我使用的几何信息对于两个邮政编码是不正确的。有谁知道我可以去哪里获取这两个特定邮政编码的KML信息?我在这里看到了很多关于用于KML数据的资源的帖子,但它们非常先进,我不知道如何挖掘论坛上其他人所链接的数据库。

具体来说,我需要邮政编码08559和08757的KML邮政编码数据。以下是我对这些邮政编码的有缺陷的KML数据:

08559:

<Polygon><outerBoundaryIs><LinearRing><coordinates>-74.892528,40.414294,0.0 -74.967386,40.39857,0.0 -75.060361,40.420788,0.0 -75.064463,40.500774,0.0 -75.06583,40.517523,0.0 -75.068223,40.457705,0.0 -74.991314,40.481632,0.0 -74.88911,40.47001,0.0 -74.892528,40.414294,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon>

08757:

<Polygon><outerBoundaryIs><LinearRing><coordinates>-74.190432,39.946002,0.0 -74.221537,39.932329,0.0 -74.322374,39.946002,0.0 -74.234185,40.008896,0.0 -74.26905,39.986678,0.0 -74.206839,39.952154,0.0 -74.19761,39.949762,0.0 -74.190432,39.946002,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon>

2 个答案:

答案 0 :(得分:1)

仅针对美国邮政编码,可从美国人口普查中获得数据: http://www.census.gov/geo/www/cob/z52000.html#ascii

下载新泽西州或其他50个州的ASCII数据集。

您可以在小文件中查找邮政编码的索引(例如zt34_d00a.dat)

 317
 "08559"
 "08559"
 "Z5"
 "5-Digit ZCTA"

然后在大文件中找到匹配的lon / lat坐标列表。

317      -0.749719256389896E+02       0.404391641604938E+02
      -0.750611840000000E+02       0.404766960000000E+02
      -0.750607720000000E+02       0.404766880000000E+02
      -0.750620530000000E+02       0.404692640000000E+02
      -0.750637010000000E+02       0.404652440000000E+02
...
      -0.750622670000000E+02       0.404709200000000E+02
      -0.750611840000000E+02       0.404766960000000E+02
END

第一个值是经度,第二个值是十进制度的纬度。

注意某些要点可能无序(或错误),因此您可能需要在转换为KML后进行清理。帮助调试点和删除坏点的一个方便工具是KML Number-the-points tool,它生成KML地标,每个地标都有一个数字标签,对应于行或多边形中的每个点,给定一些KML作为输入。如果有很长的点列表并且需要轻松识别它们,则很有用。

答案 1 :(得分:1)

如何使用多个邮政编码创建区域地图

  1. census.gov下载包含所有美国邮政编码的KML文件。此网站上的最新文件是:http://www2.census.gov/geo/tiger/GENZ2015/kml/cb_2015_us_zcta510_500k.zip。如果此链接中断,请搜索Google site:census.gov KML ZIP。另一种选择:https://www.filosophy.org/post/17/zipcodes_in_kml/

    1. 在纯文本编辑器中打开这个巨大的(175MB)文本文件并搜索所需的邮政编码并复制<Polygon>部分。以下是搜索>94117时的结果:

      <Placemark id="cb_2015_us_zcta510_500k.kml">
      <name>&lt;at&gt;&lt;openparen&gt;&lt;closeparen&gt;</name>
      <visibility>1</visibility>
      <description><![CDATA[<center><table><tr><th colspan='2' align='center'><em>Attributes</em></th></tr><tr bgcolor="#E3E3F3">
      <th>ZCTA5CE10</th>
      <td>94117</td>
      </tr><tr bgcolor="">
      <th>AFFGEOID10</th>
      <td>8600000US94117</td>
      </tr><tr bgcolor="#E3E3F3">
      <th>GEOID10</th>
      <td>94117</td>
      </tr><tr bgcolor="">
      <th>ALAND10</th>
      <td>4373059</td>
      </tr><tr bgcolor="#E3E3F3">
      <th>AWATER10</th>
      <td>1625</td>
      </tr></table></center>]]></description>
      <LookAt>
      <longitude>-102</longitude>
      <latitude>38.5</latitude>
      <range>7000000</range>
      <tilt>10</tilt>
      <heading>0</heading>
      </LookAt>
      <styleUrl>#KMLStyler</styleUrl>
      <ExtendedData>
      <SchemaData schemaUrl="#kml_schema_ft_cb_2015_us_zcta510_500k">
      <SimpleData name="ZCTA5CE10">94117</SimpleData>
      <SimpleData name="AFFGEOID10">8600000US94117</SimpleData>
      <SimpleData name="GEOID10">94117</SimpleData>
      <SimpleData name="ALAND10">4373059</SimpleData>
      <SimpleData name="AWATER10">1625</SimpleData>
      </SchemaData>
      </ExtendedData>
      <Polygon>
      <extrude>0</extrude>
      <tessellate>1</tessellate>
      <altitudeMode>clampToGround</altitudeMode>
      <outerBoundaryIs>
      <LinearRing>
      <coordinates>-122.477297,37.766069,0 -122.477379,37.765482,0 -122.458405,37.76616,0 -122.45779,37.766015,0 -122.457536,37.763566,0 -122.455999,37.763904,0 -122.456994,37.761842,0 -122.459173,37.761912,0 -122.455944,37.760239,0 -122.456603,37.759235,0 -122.454002,37.758785,0 -122.451817,37.759453,0 -122.447682,37.75919,0 -122.446783,37.761781,0 -122.445309,37.76188,0 -122.442915,37.763648,0 -122.443347,37.765333,0 -122.441242,37.765271,0 -122.4382,37.767159,0 -122.435624,37.767328,0 -122.435794,37.769058,0 -122.429128,37.769456,0 -122.428426,37.770452,0 -122.429178,37.774181,0 -122.429929,37.777909,0 -122.430115,37.778842,0 -122.444967,37.776958,0 -122.44478,37.776017,0 -122.446471,37.775802,0 -122.446846,37.777669,0 -122.453188,37.776853,0 -122.45281,37.774995,0 -122.463749,37.773624,0 -122.464611,37.77244,0 -122.459162,37.771314,0 -122.459901,37.770442,0 -122.464402,37.769669,0 -122.467004,37.768013,0 -122.469758,37.769209,0 -122.472245,37.76861,0 -122.473124,37.767116,0 -122.477297,37.766069,0 </coordinates>
      </LinearRing>
      </outerBoundaryIs>
      </Polygon>
      </Placemark>
      

      1. 创建一个干净的KML文件并将<Polygon>移动到此文件。下面是一个包含两个邮政编码多边形的KML文件(service-delivery-area.kml)的示例。 Google有一个很棒的KML Reference

        <?xml version="1.0" encoding="UTF-8"?>
        <kml xmlns="http://www.opengis.net/kml/2.2">
          <Document>
            <name>Service Delivery Area</name>
            <open>0</open>
            <Placemark>
              <name>94117</name>
              <Polygon>
                <outerBoundaryIs>
                  <LinearRing>
                    <coordinates>
                      -122.477297,37.766069,0 -122.477379,37.765482,0 -122.458405,37.76616,0 -122.45779,37.766015,0 -122.457536,37.763566,0 -122.455999,37.763904,0 -122.456994,37.761842,0 -122.459173,37.761912,0 -122.455944,37.760239,0 -122.456603,37.759235,0 -122.454002,37.758785,0 -122.451817,37.759453,0 -122.447682,37.75919,0 -122.446783,37.761781,0 -122.445309,37.76188,0 -122.442915,37.763648,0 -122.443347,37.765333,0 -122.441242,37.765271,0 -122.4382,37.767159,0 -122.435624,37.767328,0 -122.435794,37.769058,0 -122.429128,37.769456,0 -122.428426,37.770452,0 -122.429178,37.774181,0 -122.429929,37.777909,0 -122.430115,37.778842,0 -122.444967,37.776958,0 -122.44478,37.776017,0 -122.446471,37.775802,0 -122.446846,37.777669,0 -122.453188,37.776853,0 -122.45281,37.774995,0 -122.463749,37.773624,0 -122.464611,37.77244,0 -122.459162,37.771314,0 -122.459901,37.770442,0 -122.464402,37.769669,0 -122.467004,37.768013,0 -122.469758,37.769209,0 -122.472245,37.76861,0 -122.473124,37.767116,0 -122.477297,37.766069,0
                    </coordinates>
                  </LinearRing>
                </outerBoundaryIs>
              </Polygon>
            </Placemark>
            <Placemark>
              <name>94102</name>
              <Polygon>
                <outerBoundaryIs>
                  <LinearRing>
                    <coordinates>
                      -122.429929,37.777909,0 -122.429178,37.774181,0 -122.428426,37.770452,0 -122.42822,37.769441,0 -122.426402,37.769596,0 -122.419334,37.77521,0 -122.419219,37.775316,0 -122.418704,37.775645,0 -122.404743,37.786778,0 -122.406399,37.786615,0 -122.406771,37.788499,0 -122.408595,37.789226,0 -122.411886,37.788808,0 -122.414807,37.78652,0 -122.414242,37.783724,0 -122.419182,37.783101,0 -122.420689,37.781955,0 -122.420906,37.782883,0 -122.422287,37.781752,0 -122.424108,37.782477,0 -122.427396,37.782057,0 -122.426829,37.779258,0 -122.429929,37.777909,0
                    </coordinates>
                  </LinearRing>
                </outerBoundaryIs>
              </Polygon>
            </Placemark>
          </Document>
        </kml>
        

        1. 转到https://www.google.com/mymaps/并创建新地图。点击&#34;添加新图层&#34;,然后点击&#34;导入&#34;,然后上传您的KML文件。如果多边形不正确,您可以在地图上编辑多边形。

          1. 您的地图应该有如下结果:https://www.google.com/maps/d/u/0/embed?mid=1zop5GMD1b2afmOvObQIi7YvF1d4