https://github.com/nagam11/countries-borders
Dataset of countries borders for iOS in form of a plist
https://github.com/nagam11/countries-borders
country-data country-information ios mapkit maps
Last synced: 3 months ago
JSON representation
Dataset of countries borders for iOS in form of a plist
- Host: GitHub
- URL: https://github.com/nagam11/countries-borders
- Owner: nagam11
- License: mit
- Created: 2018-03-28T01:26:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-31T22:05:59.000Z (about 7 years ago)
- Last Synced: 2025-01-08T01:48:08.340Z (5 months ago)
- Topics: country-data, country-information, ios, mapkit, maps
- Size: 290 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iOS MapKit Overlay Coordinates
A dataset of countries borders for iOS (pList format). The dataset currently contains 50 US states and 13 European countries. Every country is identified by its country code (for example ITA for Italy, POR for Portugal).## How to encode for MapKit
```
public static func getStates() -> [State] {
guard let path = Bundle.main.path(forResource: "States", ofType: "plist"), let array = NSArray(contentsOfFile: path) else { return [] }
var states = [State]()
for item in array {
let dictionary = item as? [String : Any]
let code = dictionary?["code"] as? String
let name = dictionary?["state"] as? String
let borders = dictionary?["borders"] as! [NSArray]
var points = [CLLocationCoordinate2D]()
for coordinate in borders {
let latitude = coordinate[0] as? Double ?? 0
let longitude = coordinate[1] as? Double ?? 0
let coordinate = CLLocationCoordinate2DMake(latitude, longitude)
points.append(coordinate)
}
let state = State(code: code, name: name, borders: points)
states.append(state)
}
return states as [State]
}
```
## Use Case
The dataset can be used to draw borders between countries using `MKPolyline` and `MKPolygon` from MapKit.
![]()
## TODOs
- [ ] Add all European countries
- [x] Add all US states