IOS overlay (MKPolygon) for all US states?

In the " Map Overlay " section of the Programming Guide for Locating the iOS Developer Library , an example is provided that "shows a filled and crossed out 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 coordinate source for all 50 US states that uses the same latitude / longitude data freely and freely?

+6
source share
1 answer

Crawled Google Search for Location Status and found a stackoverflow query for State / Province Borders -> Google Maps Polygon , which has an XML- related response for US state polygons (data in Colorado 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 the U.S. and U.S. country coordinates with reference to NationalAtlas.com, the administrative boundaries of the first level (state), USA, 2005 , but this data looks much more accurate than I need.

Another source of data was the State Border Dataset , which is associated with a file with the “geographical coordinates of the line segments that make up the state borders” (data in Colorado 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 have posted an updated version of state.xml as well as Objective-C code on kjhsoftware / us-state-polygons github repo.

+8
source

Source: https://habr.com/ru/post/911159/


All Articles