I have a GeoJSON dataset of the following format (LineString features):

  "type": "FeatureCollection",
  "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },

  "features": [
    { "type": "Feature", "properties": { "id": 433775, "clazz": 72, "flags": 7, "source": 26697, "target": 48416, "kmh": 10, "time": 1 }, "geometry": { "type": "LineString", "coordinates": [ [ 13.3782144, 52.516451399999973, 0.0 ], [ 13.3782407, 52.5163161, 0.0 ] ] } },
    { /* [... around 13k features ...] */ },
    { "type": "Feature", "properties": { "id": 377768, "clazz": 51, "flags": 7, "source": 270569, "target": 270570, "kmh": 5, "time": 600 }, "geometry": { "type": "LineString", "coordinates": [ [ 13.388153799999985, 52.492538299999971, 0.0 ], [ 13.3881033, 52.4924441, 0.0 ] ] } }

For a research project I need this featureset to be cut into tiles of different zoom levels.

  • without generalization / simplification of geometries
  • without caching and writing results to new GeoJSON files on disk

I had a look at geojson-vt by mapbox and it seams it only generates the tiles on the fly, but I need them on the disk for further processing and investigation.

Is that possible? If so, how?


  • I'm on ArchLinux, command line tools like ogr2ogr or any C/C++ tools would be the best, regarding speed.
  • I already tried tilestache but it is totally broken and not well maintainted. Couldn't get it running.
  • Input aswell as output should be GeoJSON (or any vector format).
  • I'm talking about tiles a la Google Maps. The zoom factor for the resulting tiles should be 12, 13 or 14.

The result should be something like this:


A collection of GeoJSON tiles cut from the original vector data.

  • You say that you want to cut tiles without caching the results and then later you say that you want to have them on disk for further processing and investigation, I don't think that will be possible, Anyway take a look at tilestache.org it should have what you need Commented Feb 10, 2016 at 13:06
  • By modifying the mapbox code to save locally, perhaps with nodejs? But you don't really say what your environment is. Commented Feb 10, 2016 at 13:07
  • Do you mean tile as a picture ? (e.g PNG) To summarize, you have one geojson file and you want many PNG tiles ? The answer from @HasanMustafa is right, your question is not clear.
    – etrimaille
    Commented Feb 10, 2016 at 13:13
  • can you explain more about the different scales? this is vector data it doesn't really have a scale (especially if you don't simplify)
    – Ian Turton
    Commented Feb 10, 2016 at 13:16
  • I'm sorry, my head is so deep in that, I thought my question was clear. I added 4 updates.
    – q9f
    Commented Feb 10, 2016 at 13:20

2 Answers 2


I've written my own geojson map tiler driver in ruby. it's a quick and dirty ruby script to create geojson tiles from a postgis database using gdal/ogr. I could not find out how to cut the geojson directly, so I imported the json into a postgis database and exported them using ogr.

ogr is supposed to read geojson but I could not get the driver to work directly. maybe someone else can figure out how. here is how it worked for me using postgis:


  • ruby > 1.9.3, but ruby > 2.0.0 recommended
  • gdal/ogr > 2.0.0, the script utilizes the system command ogr2ogr
  • postgresql > 9.0.0, with postgis > 2.0.0 extension installed


setup environment

#!/usr/bin/env ruby

require 'mkmf'
require 'fileutils'
require './tiler/geojson.rb'

geojson_tiler = Tiler::GeoJson.new

set up working directory

geojson_tiler.set_basedir "/path/to/my/tiles"

enable verbose verbose output if desired

geojson_tiler.debug true

setup postgis database connection and sql query to retrieve geodataset

connection = "'PG:host=localhost dbname=distance user=qwertyu password=asdfghj'"
sql_query = "'SELECT id,flags,kmh,geom_way_web_mercator,time FROM streets WHERE time <= 600 ORDER BY time ASC'"
geojson_tiler.setup_db connection, sql_query

write full tile stack for zoom levels 0, 1, 2 and 3

(0..3).each do |zoom|
  geojson_tiler.write_tiles zoom

or write partial tile stack for zoom level 8 in range x: 136..138 and y: 82..84

geojson_tiler.write_tiles 8, 136, 138, 82, 84

syntax is zoom, xmin, xmax, ymin, ymax


is a full or partial stack of geojson tiles:


A little late to the game but if you want vector tiles in mbtiles format then I suggest the following:

(1) tippecanoe: Go to https://github.com/mapbox/tippecanoe and install it, if you are on a mac then brew install tippecanoe; Next you can tile the geojson directly using the following command: tippecanoe -e tiles -l layer_name file.geojson

Next, because they are gzipped using this method, you need to use the following commands(same if you use mbutil to unpack a .mbtiles file and get them that way):

cd /{the tiles folder}
gzip -d -r -S .pbf *;
find . -type f -exec mv '{}' '{}'.pbf \;

Then, in your style.json sources use the tile package in the following way(if you are serving them on a server then use http, if on a device use file:///, etc):

  "sources": {
        "customtiles": {
            "type": "vector",
            "tiles": [
            "minzoom": 0,
            "maxzoom": 18

And in your layers section: layers:[{ "id": "rds", "type": "line", "source": "customtiles", "source-layer": "layer_name", "paint": { "line-opacity": 0.8, "line-width": 2, "line-color": "#FF0000" } },...]

(2) Use the nodejs geojson-vt and vt-pbf method. I am personally using this as I am running it on Heroku and do not want to make a module using C++ or make a Heroku add on/use a child process. One great example for this is found at https://github.com/NYCPlanning/geojson2mvt. Essentially you can just change this script to output pbfs instead of mvts and it works.

One big difference is that geojson-vt simplifies a lot and tippecanoe does not. Thus geojson-vt tiles are much smaller and I have not found the quality degrade too much. For an on-the fly version check out this example: http://fuzzytolerance.info/blog/2016/07/31/Adding-GeoJSON-and-MVT-to-PostGIS-HTTP-API/

  • 1
    You can create uncompressed tiles directly using the -pC or --no-tile-compression switches. Commented Apr 21, 2020 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.