2

I want to generate .pdf vector tiles from polygon features. From what I've found out, tippecanoe seems to be the way to go. Like so (found here):

tippecanoe --no-feature-limit --no-tile-size-limit --no-tile-compression --output-to-directory directory layerName.json

I'm pondering the optimal workflow. My data is provided in a database from which I can easily build CSV. Tippecanoe can read CSV but apparently for point features only. However, I need polygons. I could generate the input as a geocsv as specified here with the geometries provided in some way, e. g. as WKT (polygon examples from here).

id   name      attr1     attr2    geom
1    garden1   green     round    POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
2    garden2   emerald   edgy     POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))

There is a file geojson.cpp in the tippecanoe Github but it doesn't look like it's using this specification and I can't find any documentation for it. So I wonder if there's a way to build vector tiles in tippecanoe (or any other software) without taking the detour of generating GeoJSON first.

3

1 Answer 1

2

Still not sure if that's the optimal workflow to get from CSV to MVT but I ended up using GeoJSON as an intermediate step. This can be done easily with GDAL/ogr2ogr:

CSV (geometry saved in column named geom, in WKT format):

id   name      attr1     attr2    geom
1    garden1   green     round    POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
2    garden2   emerald   edgy     POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))

CSV → GeoJSON:

ogr2ogr -f GeoJSON output1.json input.csv -oo GEOM_POSSIBLE_NAMES="geom" -oo KEEP_GEOM_COLUMNS=NO

GeoJSON → PBF: (with tippecanoe or, alternatively, with GDAL; the directory of the second output is called output2_directory in my examples)

tippecanoe --zg --output-to-directory output2_directory output1.json
ogr2ogr -f MVT output2_directory output1.json -dsco FORMAT=DIRECTORY -dsco COMPRESS=NO 

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.