- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在Displaying Overlays on a Map节iOS Developer Library Location Awareness Programming Guide,有一个示例“显示覆盖科罗拉多州的填充和描边叠加层。”
// 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];
问题是否有美国所有 50 个州的坐标数据来源,可以随时免费使用相同的纬度/经度数据?
最佳答案
在 Google 上搜索 us state outline geo coordinates 并找到 stackoverflow 问题 Geographical boundaries of states/provinces -> Google Maps Polygon ,它有一个链接到 XML for US state polygons 的答案(下面是科罗拉多州的数据)。
<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>
我还找到了US State and Country border coordinates带有指向 NationalAtlas.com, First Level Administrative Boundaries (States), United States, 2005 的链接,但该数据看起来比我需要的精确得多。
另一个数据源是 The State Border Data Set它链接到一个文件,其中包含“构成州边界的线段的地理坐标”(下面的科罗拉多州数据)。
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 ,
更新:我将 states.xml 的改进版本以及 Objective-C 代码放在 kjhsoftware/us-state-polygons 上github repo 。
关于美国所有州的 iOS 覆盖 (MKPolygon) 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9779978/
我知道确实有一个具体问题讨论了这一点,但它有点老了,如果可能的话,我想了解更多技术性知识。 首先看一下这个截图:https://www.dropbox.com/s/f94q3qaxrog0ec9/in
我正在尝试查找 MKPolygon 叠加层中包含的邮政编码。我知道找到包含坐标的邮政编码很简单。多边形所包含的面积怎么样? 我正在考虑的一些方法: 只需使用多边形边界线坐标中的邮政编码即可。该方法
大家好,这是一个看似简单的问题,但对我来说显然太复杂了。我正在尝试创建一个 MKPolygon 实例,但进展不太顺利。这是代码: MKMapPoint point1 = {38.53607,-121.
我在互联网上搜索过,但找不到这个问题的答案。可以在 MKPolygon 中画一个洞吗?像这样: 我记得我见过这样的东西,但我不确定它是否与iOS有关。可以这样做吗?(如果可以的话)我应该如何开始? 谢
试图弄清楚这个 MKPolygon 的工作原理。我创建了整个堆 MKMapPoints 并将它们放入一个数组中。然后我用它们制作一个多边形: [MKPolygon polygonWithPoints:
我正在我的 MKMapView 中绘制一堆 MKPolygons。其中一些彼此叠放。如何将选定的多边形置于顶部/前面? 我在从多边形层创建的 MKPolygonView 上尝试了 bringSubvi
我试图在我的 map 上创建一个形状,但我很难找到有关使用 swift 的 mkpolygon 的任何信息。我希望这里的人能看到这一点并指出我正确的方向。 这是我目前拥有的,但多边形没有出现。 fun
我第一次使用 MKPolygon 和 MKPolygonView 作为 map 叠加层。我可以在一个区域上放置一个形状,填充颜色填充多边形的内部。 我正在寻找一种方法,可以在我的 map 上除多边形内
我已经创建了一个 MKMapView,其中包含基于坐标的 MKPolygon。 map 上有多个多边形(查看 here 以了解我重新创建为应用程序的示例)。 我想要做的是,当用户触摸多边形时,它会打开
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我有一个应用程序,它允许用户绘制他们自己的地理围栏。现在它的工作方式是用户在屏幕上绘制他们的地理围栏,应用程序跟踪他们正在绘制的位置并将他们的路径存储到 CGMutablePath 中。 我的问题是如
我一直在尝试对 MKPolygon 进行计算,我已经点击了此处的几个链接并进行了相应的调整。我似乎无法正确计算平方米。如果需要,我可以提供更多信息 这是我的代码 func polygonArea()
我正在尝试使用以下代码呈现 MKPolygon: NSMutableArray *overlays = [NSMutableArray array]; for (NSDictionar
我正在开发一个带有 map 的应用程序,用户可以在其中绘制多边形区域。 我的问题是可以用节点绘制多边形(见图片)(我不知道节点是否是正确的词)。我没有找到防止多边形打结的简单方法。对于附图的情况,我希
我想知道点击是否在 MKPolygon 内。 我有一个 MKPolygon: CLLocationCoordinate2D points[4]; points[0] = CLLocationCoor
我正在尝试使用一组坐标的外边界构建 MKPolygon。 据我所知,Xcode 中没有提供实现此目的的功能(MKPolygon 方法将使用所有点来构建多边形,包括内部点)。 经过一些研究,我发现凸包可
我有一个带有多边形覆盖层的 MKMapView,我需要将其转换为 UIView。我有对 MKMapView 和 MKPolygon 的引用,但我似乎无法找到一种方法来提取 MKPolygon 的坐标并
我在应用程序中使用许多 MKPolygon 对象来在其 map View 中显示各种元素。我希望能够更灵活地控制这些对象,并希望能够针对特定方法编辑它们的 alpha。据我所知,该类没有 alpha
这里是菜鸟。我已经阅读了如何检测 MKPolygon 中的点,但我在实现它时遇到了困难 - 它可能只与代码中我正在检查用户位置的部分有关......我不是即使确定它是否持续检查。无论如何,这是相关代码
我想在使用 Mapkit 的 MKMap 上使用 MKPolygon 绘制走廊。我有一条从 A 站到 B 站的路线。 我在绘制走廊的路线周围有 MKMapRects。现在我想将所有矩形合并为一个多边形
我是一名优秀的程序员,十分优秀!