What is GeospatialSwift?
GeospatialSwift is an interface to translate a GeoJson document / dictionary into a swift object which fully conforms to the more recent GeoJson specification - August 2016.
A GeoJsonObject can be transformed to a bounding box.
- Unit tested with high coverage
- Ongoing development
github "MonsantoCo/GeospatialSwift" ~> 1.0.0
.package(url: "[email protected]:MonsantoCo/GeospatialSwift.git", from: "1.0.0")
Geospatial
- The main interface consisting of 4 sub interface
Geospatial.geoJson
- Full GeoJson specification support to create a GeoJsonObject
- A GeoJsonObject is the base object of GeospatialSwift functionality
- Bounding Box generated from any GeoJsonObject
- GeoJson generated from any GeoJsonObject
-
Minimum distance to a given point (Optional error distance)
-
Contains a given point (Optional error distance)
-
Bounding box for any shape
-
GeoJson returned as a Dictionary
-
Coordinates array for the associated geometry
-
Line segments with midpoint and bearing functions
-
Point
- Normalize
-
MultiPoint
-
LineString
- Length
-
MultiLineString
- Length
-
Polygon
- Centroid
- Area
-
MultiPolygon
- Area
-
GeometryCollection
-
Feature
-
FeatureCollection
Geospatial.geohash
- Create a geohash from a coordinate or bounding box
- Get geohash neighbors (8)
- Create a bounding box for a geohash
Geospatial.parse(wkt: String) -> GeoJsonObject
- Minimal WKT parsing support which transforms to a GeoJsonObject.
- POINT, LINESTRING, MULTILINESTRING, POLYGON, MULTPOLYGON.
- This is currently only intended to parse a very simple WKT string
- Bootstrap Example:
rm -rf *.xcodeproj || rm -rf .build || swift package resolve && swift package generate-xcodeproj && open *.xcodeproj
- In the Target
GeospatialSwift
, select the tabSigning & Capabilities
and check the boxAutomatically manage signing
- In the scheme menu, select
Edit Scheme...
, select theTest
item on the left, select the tabOptions
, and check the boxGather coverage for "all targets"
- In the target
GeospatialSwiftTests
select the tabBuild Phases
and add aRun Script Phase
with the body$PROJECT_DIR/Scripts/parrot.sh
and move the item to the top of the Buld Phases just belowDependencies
. - In the target
GeospatialSwift
select the tabBuild Phases
and add aRun Script Phase
with the body$PROJECT_DIR/Scripts/swiftlint.sh
.
- Setup: Package Manager Example:
rm -rf *.xcodeproj || rm -rf .build || swift package resolve && swift package generate-xcodeproj && open *.xcodeproj
- Building: In the Target
GeospatialSwift
, select the tabSigning & Capabilities
and check the boxAutomatically manage signing
- Code Coverage: In the scheme menu, select
Edit Scheme...
, select theTest
item on the left, select the tabOptions
, and check the boxGather coverage for "all targets"
- Mocking: In the target
GeospatialSwiftTests
select the tabBuild Phases
and add aRun Script Phase
with the body$PROJECT_DIR/Scripts/parrot.sh
and move the item to the top of the Buld Phases just belowDependencies
. - Linting: In the target
GeospatialSwift
select the tabBuild Phases
and add aRun Script Phase
with the body$PROJECT_DIR/Scripts/swiftlint.sh
.