Search code examples
pythonmapboxgeojsonvector-tiles

Issue converting geojson file to vector tile(s) using mapbox-tile-copy


So I have tried to follow the instructions in the README for mapbox-tile-copy at the following url: https://github.com/mapbox/mapbox-tile-copy

Right now I am in the project root directory where the geojson file exists and where a folder called tester exists that I want the vector tiles saved in. I try running the following command, which seems like it should work:

mapbox-tile-copy gjson.geojson file://./tester

but this gives the error:

Unknown filetype

I'm not sure what it is complaining about here. I guessed the geojson filetype is unknown but mapbox-tile-copy specifically says they support geojson AND give examples of it working. Could it be the geojson file is not in the correct structure or something? thanks


Solution

  • There are two possibilities here:

    1. Your geojson file is improperly formatted
    2. mapbox-tile-copy is implicitly trying to convert to a tile structure

    I believe #1 is the most likely, but I'm mentioning 2 just in case.

    For #1, you can use a tool like http://geojsonlint.com/ to quickly see if there's a problem with your .geojson file.

    I mention #2 because, based on the examples given in the usage section of the tools README.md, it looks like the expectation when you provide a .geojson is that this will be converted into vector tiles. So you might need to specify some {z}/{x}/{y} parameters in your output argument. Like so:

    mapbox-tile-copy gjson.geojson file://./tester/{z}/{x}/{y}