I wish to construct a pipleline that takes GeoJSON through to self-hosted MapBox vector tiles specification.

My plan is:

  1. Tippecanoe converts geojson to .mbt
  2. mbutil converts mbt to tiles
  3. tileserver-php exposes endpoint for tiles.

This seems to be possible, given the docs. I have put it all together. No errors are thrown by any process and tileserver is showing that my tileset exists. However, there is an empty preview of the data and HTTP GET requests to the Z/X/Y endpoint return an HTML page (Welcome to Maps hosted with TileServer-php v2.0). (Perhaps I need to curl with specific headers in order to test if it's working?)

My GeoJSON is an array of linestrings & is structured like this:

  "type": "FeatureCollection",
  "bbox": [-119.437,33.298,-116.724,34.583],
  "features": [
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
      "properties": {
    }, ...

Using tippecanoe - appears to be OK:

$ tippecanoe -o out.mbt in.json
For layer 0, using name "my_layer"
99641 features, 2896256 bytes of geometry, 2482729 bytes of metadata, 1532578 bytes of string pool
tile 5/5/12 size is 674507 with detail 12, >500000
tile 6/10/25 size is 537511 with detail 12, >500000
tile 6/11/25 size is 608121 with detail 12, >500000
tile 7/21/51 size is 665802 with detail 12, >500000
tile 7/22/51 size is 685644 with detail 12, >500000
tile 7/22/51 size is 538985 with detail 11, >500000
tile 8/44/102 size is 754537 with detail 12, >500000
tile 8/43/102 size is 750288 with detail 12, >500000
tile 8/44/102 size is 652762 with detail 11, >500000
tile 8/43/102 size is 633573 with detail 11, >500000
tile 8/44/102 size is 513572 with detail 10, >500000
tile 9/88/204 size is 518065 with detail 12, >500000
tile 9/87/204 size is 765483 with detail 12, >500000
tile 9/87/204 size is 697630 with detail 11, >500000
tile 9/87/204 size is 583396 with detail 10, >500000
  100.2%  14/2773/6531

Tileserver docs say it works better if I run mbutil over the mbt file first. I do this with the command mb-util out.mbt tiles. There's a lot of output in the format similar to:

INFO:mbutil.util:3774 / 3774 tiles exported

Afterwards, the directory tiles has a 3-levels deep nested structure with lots of files ending with png. Despite the extension, the OS cannot render these as raster images. But given what they're intended to do I assume they're not PNGs as I'm used to and that this is expected.

Finally, I push the tiles along with the Tileserver code onto a PHP-enabled host in ElasticBeanstalk. The app runs and presents me with my tileset, rendered as a completely empty (black) MapboxGL view.

Here, let me show you.

So it seems nothing threw any errors, but I don't have any data. How can I find where this all went wrong?

  • Instead of the Z/X/Y endpoint try using a proper endpoint where you know the data exists. – Hasan Mustafa May 11 '16 at 6:09
  • Thanks, but I don't know any such endpoint. How can I find one? I can show an OSM layer through the OpenLayers 3 preview, and there's no data at locations where I'd expect there to be some. – Synesso May 11 '16 at 6:24
  • You have them listed here already, starting from: tile 5/5/12 size is 674507 with detail 12, >500000 – Hasan Mustafa May 11 '16 at 6:27
  • tileserve-stg.us-west-2.elasticbeanstalk.com/tileserver.php?/… - "tile does not exist". Is that the correct URL format? – Synesso May 11 '16 at 6:29
  • That does not look correct to me, you are hosting the tiles online? – Hasan Mustafa May 11 '16 at 6:33

Vector tiles are served by tileserver-php correctly.

Here is an example: http://osm2vectortiles.tileserver.com/

Be sure you:

  • download the tileserver.php project as zip from github: https://github.com/klokantech/tileserver-php/archive/master.zip

  • unpack on your Apache+PHP hosting the complete content of the archive (tileserver.php as well as the .htaccess file)

  • upload to your hosting the vector tiles as a single MBTiles file. The file must have an extension .mbtiles and should be located in the same folder as the tileserver.php and .htaccess files are. It should have correct metadata table. If you generate it with MapBox Studio Classic it will have it. I expect tippecanoe utility will produce it in a correct format as well.

This is sufficient. You should get the x-ray viewer and nice URLs, including TileJSON usable in MapBox Studio Classic, MapBox GL JS, MapBox SDK for Android and iOS, OpenLayers, Leaflet with MVT extension, or any other compatible software.

This installation is step by step described at: http://www.maptiler.com/how-to/tileserver-php/ - vector tiles are hosted the same way as raster tiles generated by http://www.maptiler.com/.

If you are familiar with Docker / Kitematic - there is a ready to use image. Check Docker CLI tutorial: http://osm2vectortiles.org/docs/serve-vector-tiles/. The same applies for Kitematic graphical user interface for Docker.

I guess, the mistakes you may make in your workflow could be: using mbutil, naming the file with extension .mvt, not installing .htaccess on your web hosting.

  • Correct, these were the two things that differed from your instruction. Changed those and all is well. Huzzah! PS, thank you for making tileserver. It was straightforward. – Synesso May 11 '16 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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