https://github.com/manimaul/SwiftVectorTiles
A Swift Mapbox vector tile encoder
https://github.com/manimaul/SwiftVectorTiles
Last synced: 6 months ago
JSON representation
A Swift Mapbox vector tile encoder
- Host: GitHub
- URL: https://github.com/manimaul/SwiftVectorTiles
- Owner: manimaul
- License: other
- Created: 2016-12-28T21:23:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-17T15:15:23.000Z (almost 5 years ago)
- Last Synced: 2024-08-03T19:08:45.009Z (over 1 year ago)
- Language: Swift
- Size: 1.99 MB
- Stars: 13
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-vector-tiles - SwiftVectorTiles - A Swift encoder for vector tiles according to the Mapbox vector tile spec. (Parsers & Generators)
README
# SwiftVectorTiles
A Swift encoder for vector tiles according to the [Mapbox vector tile spec](https://github.com/mapbox/vector-tile-spec)
### Acknowledgements
* [Java Vector Tiles](https://github.com/ElectronicChartCentre/java-vector-tile)
* [GEOS & JTS](https://trac.osgeo.org/geos/)
* [Mapbox Vector Tile Spec](https://github.com/mapbox/vector-tile-spec)
* [Swift Google Protocol Buffers](http://protobuf.io/#swift)
### Status
Beta - expect a few bugs
### Cocoapods
```ruby
use_frameworks!
target 'YourTarget' do
pod 'SwiftVectorTiles', :git => 'https://github.com/manimaul/SwiftVectorTiles.git'
end
```
### Example
```swift
// initialize an encoder
let encoder = VectorTileEncoder()
// create some attributes
var atts = [String: Attribute]()
atts["some_key"] = Attribute.attString("some_value")
// polygon geometry "well known text"
let wkt = "POLYGON ((0 0, 4096 0, 4096 4096, 0 4096, 0 0))"
// add the geometry and it's attributes as a "feature"
encoder.addFeature(layerName: "land", attributes: atts, geometry: wkt)
// encode to Mapbox vector tile
let data :Data = encoder.encode()
```
### Screenshots
| Encoded [Natural Earth Data](http://www.naturalearthdata.com/) geometries| |
| --------------------------------------------- | ---------------------------------------- |
|||