The Encoder is the main module to work with vector tiles. When talking about vector tiles, it refers to a standard developed by MapBox (https://github.com/mapbox/vector-tile-spec).
Detailed documentation of the Marauder components coming soon on our webpage https://marauder.io.
The collection consists of following charged components:
A Encoder and Decoder for Mapbox Vector Tiles. We implement the specification version 2.1 (https://github.com/mapbox/vector-tile-spec/tree/master/2.1).
- Fast vector tile encoding from simple GeoJSON like Objects
- Fast Vector tile decoding
- Efficient & flexible vector tile merging
- Directly from two BLOBs
- By injecting one tile in another's encoding function call
- Runs without JTS or GeoTools dependencies
- Also JTS Geometry support is implemented
- Allows to merge tiles without completely decoding them
Artifacts are published on OSS Sonatype and Maven Central.
Gradle dependency:
compile group: 'io.marauder.supercharger', name: 'encoder', version: '0.0.3'
compile group: 'io.marauder.supercharger', name: 'models', version: '0.0.3'
compile group: 'io.marauder.supercharger', name: 'projector', version: '0.0.3'
compile group: 'io.marauder.supercharger', name: 'utils', version: '0.0.3'
compile group: 'io.marauder.supercharger', name: 'clipper', version: '0.0.3'
For snapshots use this repository:
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
val f1 = Feature(
type = GeoJsonType.Feature,
geometry = Geometry.Polygon(
type = GeometryType.Polygon,
coordinates = listOf(
listOf(
listOf(10.0, 10.0), listOf(10.0, 20.0), listOf(20.0, 20.0), listOf(20.0, 10.0), listOf(10.0, 10.0)
)
)
),
properties = mapOf("A" to Value.StringValue("B"), "N" to Value.IntValue(3), "C" to Value.IntValue(2))
)
val f1 = JSON.plain.parse<List<Feature>>(File("features.geojson").readText())
val encoder = Encoder()
val tile : vector_tile.VectorTile.Tile = encoder.encode(listOf(f1), "test1")
val tile : vector_tile.VectorTile.Tile = encoder.encode(listOf(f2), "test2")
val bytes = File("file.pbf").readBytes()
val encoder = Encoder()
val features: List<Feature> = encoder.decode(bytes)
- Multiple layers are supported, but merging by injecting features into the encoding process does support only one layer.
- As intended our Encoder/Decoder does no coordinate transformation and clipping
Provides functionality to clip functions in x
or y
direction on given boundaries.
val clipper = Clipper()
clipper.clip(fc = featureCollection, ...)
GeoJson
- Feature collectionFeature
- A featuresGeometry
- A geometry, sub classes used to instantiateValue
- Holds a feature's property value, sub classes used to instantiate
val g1 = Geometry.fromJTS(jtsObject)
val g2 = Geometry.fromWKT(wktString)
val jts = g1.toJTS()
val wkt = g1.toWKT()
val projector = Projector(extend = 4096)
projector.transformGeometry(...)
Util functions for geometry intersection testing and geometry simplifications.
SuperCharger is licensed under the Apache License, Version 2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.