An open API service indexing awesome lists of open source software.

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

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