Skip to content

Other formats

manby reads what tippecanoe reads, GeoJSON, FlatGeobuf, CSV and Geobuf, and also GeoParquet and Arrow, shapefiles and GeoPackage. Convert other formats to FlatGeobuf first, which manby reads in parallel. The examples use GDAL’s ogr2ogr, and other converters that write FlatGeobuf, such as DuckDB’s spatial extension or terrio, work the same way.

manby reads a shapefile as it is, with its .dbf, .shx, .prj and .cpg files beside it.

Terminal window
manby -zg --coalesce-densest-as-needed -o tracts.pmtiles cb_2023_us_tract_500k.shp

The tiles are the ones manby makes from the FlatGeobuf file that GDAL writes of the shapefile. The rings of each shape become polygons and their holes as GDAL groups them, the columns are typed as GDAL types them, and the text is recoded from the encoding that the .cpg file or the .dbf language driver names (UTF-8, ISO-8859-1 or Windows-1252; other encodings are read as UTF-8). Deleted records are left out. Reading the 85,186 census tracts takes 2.1 s at -zg --coalesce-densest-as-needed, against 2.0 s from FlatGeobuf.

The coordinates are reprojected from the CRS of the .prj file: the EPSG code it gives, or that of a common CRS by the name ESRI gives it, such as WGS 84, NAD83, NAD27, ETRS89, Web Mercator, their UTM zones, British National Grid, RD New, Lambert 93, LAEA Europe and Conus Albers. For another one, give its code with -s, or reproject first:

Terminal window
manby -zg -s EPSG:2056 -o buildings.pmtiles buildings.shp
ogr2ogr -t_srs EPSG:4326 buildings-wgs84.shp buildings.shp

manby reads a GeoPackage as it is. A GeoPackage with one table of features needs nothing more. One with several needs the table named, as the layer, which -L or -l names.

Terminal window
manby -zg --coalesce-densest-as-needed -o tracts.pmtiles tracts.gpkg
manby -zg --drop-densest-as-needed -o natural-earth.pmtiles \
-L '{"file":"natural_earth_vector.gpkg","layer":"ne_10m_roads"}' \
-L '{"file":"natural_earth_vector.gpkg","layer":"ne_10m_populated_places"}'

The tiles are the ones manby makes from the FlatGeobuf file that GDAL writes of the table, with the columns as GDAL types them. The integer primary key is the feature’s number, not an attribute, and the coordinates are reprojected from the table’s CRS, unless -s names another. Reading the 85,186 census tracts from a GeoPackage takes 2.1 s at -zg --coalesce-densest-as-needed, against 2.0 s from FlatGeobuf, with no conversion before it.

tile() in R and Python reads a file in a format that GDAL reads and manby does not, such as KML, GPX, GML, OpenStreetMap, SQLite, a File Geodatabase or a spreadsheet, with sf or GeoPandas, or with DuckDB’s spatial extension if those are not installed, and reprojects it to WGS 84. The layer’s name picks the source’s layer of that name, if it has one, and otherwise the first.

tile(list(points = "liechtenstein.osm.pbf", lines = "liechtenstein.osm.pbf"),
"liechtenstein.pmtiles", maximum_zoom = 14, drop_densest_as_needed = TRUE)
manby.tile({"points": "liechtenstein.osm.pbf", "lines": "liechtenstein.osm.pbf"},
"liechtenstein.pmtiles", maximum_zoom=14, drop_densest_as_needed=True)

sf and GeoPandas read the layer into memory. DuckDB writes it to a temporary Parquet file, so it need not fit in memory.

GDAL reads an extract as the layers points, lines, multilinestrings, multipolygons and other_relations, with the common tags as attributes and the rest in other_tags.

Terminal window
ogr2ogr points.fgb liechtenstein-latest.osm.pbf points
ogr2ogr lines.fgb liechtenstein-latest.osm.pbf lines
ogr2ogr areas.fgb liechtenstein-latest.osm.pbf multipolygons
manby -z14 --drop-densest-as-needed -o liechtenstein.pmtiles \
-L points:points.fgb -L lines:lines.fgb -L areas:areas.fgb

Most downloads come zipped, or as 7z at IGN. GDAL reads a file inside the archive as it is, through /vsizip/ and /vsi7z/, so the archive needn’t be unpacked. manby itself reads neither. gdal vsi list -R lists what an archive holds, in GDAL 3.11 and later.

Terminal window
gdal vsi list -R admin-express.7z
ogr2ogr communes.fgb /vsi7z/admin-express.7z/path/in/the/archive/COMMUNE.shp

GDAL reads a File Geodatabase, a .gdb folder or a zip of one, with its OpenFileGDB driver. It holds several layers, which ogrinfo lists, so name the one to convert.

Terminal window
ogrinfo /vsizip/swissboundaries3d_2026-01_2056_5728.gdb.zip
ogr2ogr communes.fgb /vsizip/swissboundaries3d_2026-01_2056_5728.gdb.zip TLM_HOHEITSGEBIET
manby -zg --coalesce-densest-as-needed -o communes.pmtiles communes.fgb

manby reprojects from the CRS that GDAL writes into the FlatGeobuf file, here Switzerland’s LV95. A column of binary data, such as the Element of Esri’s annotation classes, stops manby as it stops tippecanoe, with flatgeobuf has unsupported column type 14. -mapFieldType Binary=String makes it text.

Some data is published only as GML, such as the Netherlands’ BGT and cadastral map. GDAL’s GML driver reads it. ogrinfo -so shows what it reads, with the geometry column. Where a feature has more than one geometry, GDAL keeps one, and not always the one wanted.

PDOK’s download API gives the BGT as CityGML, GML-light or StUF-Geo. Take GML-light. From CityGML, GDAL takes the point of a building’s house number as its geometry where it has one, for 39,732 of the 62,279 buildings in 4 km² of Amersfoort. From GML-light it takes each building’s footprint.

Terminal window
ogr2ogr -nlt CONVERT_TO_LINEAR -a_srs EPSG:28992 -where "eindRegistratie IS NULL" \
buildings.fgb /vsizip/extract.zip/bgt_pand.gml
manby -zg --drop-densest-as-needed -o buildings.pmtiles buildings.fgb
  • -nlt CONVERT_TO_LINEAR makes the arcs of the BGT’s curves straight segments. Without it, ogr2ogr stops at the first curve.
  • -a_srs EPSG:28992 names the CRS, RD New, which GDAL doesn’t find in the file.
  • -where "eindRegistratie IS NULL" keeps the current version of each object. The extract also holds the versions before it, 26,306 of the 62,279 buildings.

As GDAL reads PDOK’s cadastral map (BRK), a parcel’s geometry is its label point, plaatscoordinaten. ogrinfo writes GDAL’s description of the layer to a .gfs file beside the GML, where the parcel’s boundary, begrenzingPerceel, can be named instead. That needs the GML unpacked.

Terminal window
unzip extract.zip kadastralekaart_perceel.gml
ogrinfo -so kadastralekaart_perceel.gml > /dev/null
sed -i.bak 's/>plaatscoordinaten</>begrenzingPerceel</; s/<GeometryType>1</<GeometryType>3</' \
kadastralekaart_perceel.gfs
ogr2ogr parcels.fgb kadastralekaart_perceel.gml
manby -zg --coalesce-densest-as-needed -o parcels.pmtiles parcels.fgb

The boundaries, kadastralekaart_kadastralegrens.gml, read as they are. The buildings in the download are the BGT’s in CityGML, so take them from the BGT in GML-light.

ogr2ogr can write newline-delimited GeoJSON to its standard output, which manby reads in parallel with -P. It is a little slower, as GDAL writes GeoJSON more slowly than FlatGeobuf, 5.9 s against 5.0 s on the census tracts.

Terminal window
ogr2ogr -f GeoJSONSeq /vsistdout/ natural_earth_vector.gpkg ne_10m_roads |
manby -zg --drop-densest-as-needed -P -l roads -o roads.pmtiles

manby reprojects a FlatGeobuf file from the CRS that GDAL writes into it, as it does a GeoPackage or a shapefile. Otherwise it reads longitude and latitude in WGS 84, like tippecanoe, unless -s names another CRS. -t_srs EPSG:4326 reprojects to it, and GDAL writes newline-delimited GeoJSON in WGS 84 anyway.

-s takes Web Mercator, EPSG:3857, as tippecanoe does, and also any of the 9,508 EPSG and ESRI codes of crs-defs, whose definitions manby carries. The coordinates are made longitude and latitude with proj4rs, within centimeters of PROJ, so a file in a national grid needs no step before manby.

Terminal window
manby -zg -s EPSG:28992 -o buildings.pmtiles buildings.geojson

Converting with ogr2ogr, then tiling, once each on an Apple M5 Max with GDAL 3.13 and tippecanoe 2.82.0.

Input ogr2ogr, then manby ogr2ogr, then tippecanoe
Census tracts, Shapefile (82 MB) 2.48 + 2.49 = 4.97 s 2.48 + 24.2 = 26.7 s
Natural Earth, GeoPackage, 3 layers 0.90 + 0.95 = 1.85 s 0.90 + 5.75 = 6.65 s
Liechtenstein, OpenStreetMap, 3 layers 0.75 + 0.37 = 1.12 s 0.75 + 4.28 = 5.03 s
  • manby’s tiles decode to exactly tippecanoe’s from the same FlatGeobuf file.
  • With manby, the conversion is half the time or more.
  • The tracts are the 85,186 of the Census cartographic boundaries 2023.

ogr2ogr gives FlatGeobuf a spatial index by default, which stores the features in spatial order, and tippecanoe’s choices of what to drop or coalesce can follow the order. So the tiles can differ slightly from those of the input’s order. -lco SPATIAL_INDEX=NO keeps it.