mapchete.index module

Create various index files for a process output.

Available index types:

  • GeoPackage and GeoJSON index: Works like gdaltindex command and is useful when using process output with Mapserver later on.

  • textfile with tiles list If process output is online (e.g. a public endpoint of an S3 container), this file can be passed on to wget to download all process output.

  • VRT Virtual raster dataset format by GDAL. This enables GIS tools to read multiple files at once, e.g. QGIS can open a zoom VRT so the user doesn’t have to open all GeoTIFF files from a certain zoom level.

All index types are generated once per zoom level. For example GeoPackage will generate GPKG files 3.gpkg, 4.gpkg and 5.gpkg for zoom levels 3, 4 and 5.

class mapchete.index.TextFileWriter(out_path=None)

Bases: object

Writes tile paths into text file.

close()
entry_exists(tile=None, path=None)
write(tile, path)
class mapchete.index.VRTFileWriter(out_path=None, output=None, out_pyramid=None)

Bases: object

Generates GDAL-style VRT file.

close()
entry_exists(tile=None, path=None)
write(tile, path)
class mapchete.index.VectorFileWriter(out_path=None, crs=None, fieldname=None, driver=None)

Bases: object

Writes GeoJSON or GeoPackage files.

close()
entry_exists(tile=None, path=None)
write(tile, path)
mapchete.index.zoom_index_gen(mp=None, out_dir=None, zoom=None, tile=None, geojson=False, gpkg=False, shapefile=False, txt=False, vrt=False, fieldname='location', basepath=None, for_gdal=True, threading=False, **kwargs)

Generate indexes for given zoom level.

Parameters
mpMapchete object

process output to be indexed

out_dirpath

optionally override process output directory

zoomint

zoom level to be processed

geojsonbool

generate GeoJSON index (default: False)

gpkgbool

generate GeoPackage index (default: False)

shapefilebool

generate Shapefile index (default: False)

txtbool

generate tile path list textfile (default: False)

vrtbool

GDAL-style VRT file (default: False)

fieldnamestr

field name which contains paths of tiles (default: “location”)

basepathstr

if set, use custom base path instead of output path

for_gdalbool

use GDAL compatible remote paths, i.e. add “/vsicurl/” before path (default: True)