All Projects → rastapasta → tilegrinder

rastapasta / tilegrinder

Licence: MIT license
♻️ A node.js GIS helper library for easy alteration of Vector Tiles in an MBTiles container

Programming Languages

coffeescript
4710 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tilegrinder

savetheworldwithgo
Build systems with Go examples
Stars: ✭ 81 (+26.56%)
Mutual labels:  protobuf
compatip
A simple tool to ensure compatibility between microservices
Stars: ✭ 13 (-79.69%)
Mutual labels:  protobuf
leaflet-geojson-selector
Show GeoJSON Layer like as Interactive Menu List
Stars: ✭ 88 (+37.5%)
Mutual labels:  vector-tiles
HMap
:earth: HMap | 基于openlayers的封装组件
Stars: ✭ 64 (+0%)
Mutual labels:  vector-tiles
goprotoc
Library for writing protoc plugins in Go; also includes a pure-Go protoc replacement
Stars: ✭ 73 (+14.06%)
Mutual labels:  protobuf
aws-mobilehub-helper-ios
ARCHIVED: Use https://github.com/aws/aws-sdk-ios/
Stars: ✭ 41 (-35.94%)
Mutual labels:  helper
rok4
ROK4 est une suite d'outils open source développée par l'IGN France permettant la diffusion de données raster et vecteur en WMS, WMTS ou TMS. DEPRECATED ! Projet maintenu ici : https://github.com/rok4/documentation
Stars: ✭ 18 (-71.87%)
Mutual labels:  vector-tiles
victor
Turn mapbox vector tiles into static maps in R
Stars: ✭ 28 (-56.25%)
Mutual labels:  vector-tiles
neofs-api-go
NeoFS API Golang repository contains implementation of core NeoFS structures that can be used for integration with NeoFS.
Stars: ✭ 14 (-78.12%)
Mutual labels:  protobuf
FSharp.GrpcCodeGenerator
A protoc plugin to enable generation of F# code
Stars: ✭ 61 (-4.69%)
Mutual labels:  protobuf
protodoc
protodoc generates Protocol Buffer documentation.
Stars: ✭ 43 (-32.81%)
Mutual labels:  protobuf
protolua
C++ implement encode, decode Protocol Buffers for Lua without code generation
Stars: ✭ 117 (+82.81%)
Mutual labels:  protobuf
qtprotobuf
Protobuf generator and bindings for Qt framework
Stars: ✭ 138 (+115.63%)
Mutual labels:  protobuf
server-client-template-go
No description or website provided.
Stars: ✭ 14 (-78.12%)
Mutual labels:  protobuf
hubot-suggest
Suggest hubot commands when not found
Stars: ✭ 29 (-54.69%)
Mutual labels:  helper
git-cheatsheet
One stop guide to help solve all your doubts related to Git & GitHub.
Stars: ✭ 31 (-51.56%)
Mutual labels:  helper
DevExpress4Delphi
Class helper for DevExpress components
Stars: ✭ 22 (-65.62%)
Mutual labels:  helper
protobuf-tools
Latest version of protobuf and dozen of plugins. All in a small Docker image
Stars: ✭ 19 (-70.31%)
Mutual labels:  protobuf
protoactor-go
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 4,138 (+6365.63%)
Mutual labels:  protobuf
protoc-plugin
A protoc compiler plugin for Clojure applications
Stars: ✭ 28 (-56.25%)
Mutual labels:  protobuf

tilegrinder

npm version dependencies license

A handy library in case you ever want to apply some logic to all/some vector tiles in an MBTiles file without having to worry about how to pull, decode, alter, encode and store them again.

It's pretty simple: you define a source and a destination - and a callback which gets called with a deserialized tile object as soon as the async grinder parsed another tile. The library transparently takes care of compression, protobuf and geometry de-/encoding and rebundling of the altered data into a new MBTiles.

Take a look at tileshrink to see what you can build with it!

Requirements

  • tilegrinder uses the native protobuf wrapper library node-protobuf for its magic

  • To let it build during npm install, take care of following things:

    • Linux: libprotobuf must be present (apt-get install build-essential pkg-config libprotobuf-dev)

    • OSX: Use homebrew to install protobuf with brew install pkg-config protobuf

    • Windows: node-protobuf includes a pre-compiled version for 64bit systems

How to install it?

  • Just install it into your project folder with

    npm install --save tilegrinder

How to code it?

Following example will

  • create a new MBTiles file simple.mbtiles containing the tiles of the first 4 zoom levels of planet.mbtiles

  • only the water, admin and road layers are kept

  • while all points get moved by an offset of 256

const TileGrinder = require('tilegrinder')
    , grinder = new TileGrinder({maxZoom: 4})

grinder.grind("planet.mbtiles", "simple.mbtiles", tile => {

  // Only keep the road, water and admin layers
  tile.layers = tile.layers.filter(layer =>
    layer.name === "water" || layer.name === "admin" || layer.name === "road"
  )

  // Move each point a bit around
  tile.layers.forEach(layer => {
    layer.features.forEach(feature => {
      feature.geometry.forEach(geometry => {
        geometry.forEach(point => {
          point.x += 256;
          point.y += 256;
        })
      })
    })
  })

})

Which will generate following output:

bash$ node example.js
[>] starting to grind
[>] 38% less data in zoom 1, x: 0 y: 1
[>] 39% less data in zoom 1, x: 1 y: 1
[>] 20% less data in zoom 1, x: 0 y: 0
.......
[>] 16% less data in zoom 2, x: 2 y: 1
[>] 33% less data in zoom 4, x: 8 y: 5
[+] waiting for workers to finish...
[+] finishing database
[+] grinding done!
[>] saved 35% of storage
bash$

License

The MIT License (MIT)

Copyright (c) 2019 Michael Straßburger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].