美国所有州的iOS覆盖(MKPolygon)数据? [英] iOS overlay (MKPolygon) data for all U.S. states?

查看:130
本文介绍了美国所有州的iOS覆盖(MKPolygon)数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS中显示地图上的覆盖图部分开发者库位置感知编程指南中,有一个例子显示覆盖科罗拉多州的填充覆盖层。

  //定义覆盖科罗拉多州的覆盖图。 
CLLocationCoordinate2D points [4];

points [0] = CLLocationCoordinate2DMake(41.000512,-109.050116);
points [1] = CLLocationCoordinate2DMake(41.002371,-102.052066);
points [2] = CLLocationCoordinate2DMake(36.993076,-102.041981);
分[3] = CLLocationCoordinate2DMake(36.99892,-109.045267);

MKPolygon * poly = [MKPolygon polygonWithCoordinates:points count:4];
poly.title = @Colorado;

[map addOverlay:poly];

问题
是否有全部的坐标数据源美国50个州使用相同的经度/纬度数据可以轻松自由地获得? 大纲地理坐标和发现的stackoverflow问题地理边界的国家/省份 - > Google地图多边形,它有一个链接到 XML用于美国州多边形的答案(科罗拉多州以下数据)。

 < state name =Coloradocolor =#880000> 
< / state>

我还发现美国州和国家边界坐标,链接至 NationalAtlas.com,2005年美国第一级行政边界(州),但这些数据看起来比我需要的要精确得多。



另一个数据来源是 The状态边界数据集,它与一个文件链接组成州边界的线段的地理坐标(科罗拉多数据如下)。

<$ p $

$ b $ c $ bordindx st1st2 milemark lat lat long st1 st2
19 CO-NE 0,40.003,102.051,08,31
19 CO- NE,68.95,41.002,102.051,08,31,
19,CO-NE,173.19,41.001,104.053,08,31,
20,CO-NM,0,36 0.999,109.044,08,35,
20,CO-NM,333,37,103.001,08,35,
21,CO-OK,0,37,103.001,08,40,
21,CO-OK,52.89,36.993,102.041,08,40,
22,CO-UT,0,41,109.049,08,49,
22,CO-UT,276.11 ,36.999,109.044,08,49,
23,CO-WY,0,41.001,104.053,08,56,
23,CO-WY,260.18,41,109.049,08,56,

更新:我还提供了states.xml的精炼版本作为 kjhsoftware / us-state-polygons github repo上的Objective-C代码。


In the Displaying Overlays on a Map section of the iOS Developer Library Location Awareness Programming Guide, there is an example that "shows a filled and stroked overlay covering the state of Colorado."

// Define an overlay that covers Colorado.
CLLocationCoordinate2D  points[4];

points[0] = CLLocationCoordinate2DMake(41.000512, -109.050116);
points[1] = CLLocationCoordinate2DMake(41.002371, -102.052066);
points[2] = CLLocationCoordinate2DMake(36.993076, -102.041981);
points[3] = CLLocationCoordinate2DMake(36.99892, -109.045267);

MKPolygon* poly = [MKPolygon polygonWithCoordinates:points count:4];
poly.title = @"Colorado";

[map addOverlay:poly];

Question Is there a source of coordinate data for all 50 U.S. states using this same latitude/longitude data readily and freely available?

解决方案

Ran a Google search for us state outline geo coordinates and found stackoverflow question Geographical boundaries of states/provinces -> Google Maps Polygon, which has an answer linking to XML for US state polygons (Colorado data below).

<state name="Colorado" colour="#880000">
  <point lat="37.0004" lng="-109.0448"/>
  <point lat="36.9949" lng="-102.0424"/>
  <point lat="41.0006" lng="-102.0534"/>
  <point lat="40.9996" lng="-109.0489"/>
  <point lat="37.0004" lng="-109.0448"/>
</state>

I also found US State and Country border coordinates with a link to NationalAtlas.com, First Level Administrative Boundaries (States), United States, 2005, but that data looks much more precise than I need.

Another source of data was The State Border Data Set which linked to a file with "geographic coordinates of the line segments that make up the state borders" (Colorado data below).

bordindx, st1st2, milemark, lat, long, st1, st2,
19 ,CO-NE ,0 ,40.003 ,102.051 ,08 ,31 ,
19 ,CO-NE ,68.95 ,41.002 ,102.051 ,08 ,31 ,
19 ,CO-NE ,173.19 ,41.001 ,104.053 ,08 ,31 ,
20 ,CO-NM ,0 ,36.999 ,109.044 ,08 ,35 ,
20 ,CO-NM ,333 ,37 ,103.001 ,08 ,35 ,
21 ,CO-OK ,0 ,37 ,103.001 ,08 ,40 ,
21 ,CO-OK ,52.89 ,36.993 ,102.041 ,08 ,40 ,
22 ,CO-UT ,0 ,41 ,109.049 ,08 ,49 ,
22 ,CO-UT ,276.11 ,36.999 ,109.044 ,08 ,49 ,
23 ,CO-WY ,0 ,41.001 ,104.053 ,08 ,56 ,
23 ,CO-WY ,260.18 ,41 ,109.049 ,08 ,56 ,

Update: I put an refined version of the states.xml, as well as Objective-C code on a kjhsoftware/us-state-polygons github repo.

这篇关于美国所有州的iOS覆盖(MKPolygon)数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆