This project is no longer maintained. Please migrate to https://github.com/GEOSwift/GEOSwiftMapboxMaps
See GEOSwift for full details
- iOS 9.0+
- Swift 5.1+
- CocoaPods 1.4.0+
- MapboxGL 6
-
Follow the Mapbox Maps SDK installation instructions to configure your
~/.netrc
file. -
Update your
Podfile
to include:use_frameworks! pod 'GEOSwiftMapboxGL'
-
Run
$ pod install
import GEOSwift
import Mapbox
import GEOSwiftMapboxGL
...
let point = Point(longitude: 10, latitude: 45)
let polygon = try! Polygon(wkt: "POLYGON((35 10, 45 45.5, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))")
let annotations = [
MGLShape.make(with: point),
MGLShape.make(with: polygon)
]
self.mapView.showAnnotations(annotations, animated: true)
...
In this table you can find which annotation class you should expect when using
MGLShape.make(with:)
:
GEOSwift | MapboxGL |
---|---|
Point |
MGLPointAnnotation |
LineString |
MGLPolyline |
Polygon |
MGLPolygon |
MultiPoint |
MGLPointCollection |
MultiLineString |
MGLMultiPolyline |
MultiPolygon |
MGLMultiPolygon |
GeometryCollection |
MGLShapeCollection |
You can also use MGLShape.makeFeature(with:)
:
GEOSwift | MapboxGL |
---|---|
Point |
MGLPointFeature |
LineString |
MGLPolylineFeature |
Polygon |
MGLPolygonFeature |
MultiPoint |
MGLPointCollectionFeature |
MultiLineString |
MGLMultiPolylineFeature |
MultiPolygon |
MGLMultiPolygonFeature |
GeometryCollection |
MGLShapeCollectionFeature |
Each of these MapboxGL types also receive convenience initializers that accept the corresponding GEOSwift type.
To make a contribution:
- Fork the repo
- Start from the
main
branch and create a branch with a name that describes your contribution - Follow the Mapbox Maps SDK installation
instructions to configure
your
~/.netrc
file. - Run
$ pod install
- Open GEOSwiftMapboxGL.xcworkspace and make your changes.
- Run
$ swiftlint
from the repo root and resolve any issues. - Push your branch and create a pull request to
main
- One of the maintainers will review your code and may request changes
- If your pull request is accepted, one of the maintainers should update the changelog before merging it.
- Due to the need for a secret Mapbox token to install the Mapbox SDK, CI will not run for PRs from forks. Maintainers should be sure to run the test suite locally before accepting any changes.
- Andrew Hershberger (@macdrevx)
- Virgilio Favero Neto (@vfn)
- Andrea Cremaschi (@andreacremaschi) (original author)
- GEOSwiftMapboxGL was released by Andrea Cremaschi (@andreacremaschi) under a MIT license. See LICENSE for more information.
- GEOSwift was released by Andrea Cremaschi (@andreacremaschi) under a MIT license. See LICENSE for more information.
- GEOS stands for Geometry Engine - Open Source, and is a C++ library, ported from the Java Topology Suite. GEOS implements the OpenGIS Simple Features for SQL spatial predicate functions and spatial operators. GEOS, now an OSGeo project, was initially developed and maintained by Refractions Research of Victoria, Canada.