mapchete.formats.default.vector_file module

Vector file input which can be read by fiona.

Currently limited by extensions .shp and .geojson but could be extended easily.

class mapchete.formats.default.vector_file.InputData(input_params, **kwargs)

Bases: InputData

Main input class.

Parameters
input_paramsdictionary

driver specific parameters

Attributes
pathstring

path to input file

pixelbufferinteger

buffer around output tiles

pyramidtilematrix.TilePyramid

output TilePyramid

crsrasterio.crs.CRS

object describing the process coordinate reference system

sridstring

spatial reference ID of CRS (e.g. “{‘init’: ‘epsg:4326’}”)

METADATA = {'data_type': 'vector', 'driver_name': 'vector_file', 'file_extensions': ['shp', 'geojson'], 'mode': 'r'}
bbox(out_crs=None)

Return data bounding box.

Parameters
out_crsrasterio.crs.CRS

rasterio CRS object (default: CRS of process pyramid)

Returns
bounding boxgeometry

Shapely geometry object

cleanup()

Cleanup when mapchete closes.

in_memory_features()

This property can be accessed once the preprocessing task is finished.

open(tile, **kwargs)

Return InputTile object.

Parameters
tileTile
Returns
input tileInputTile

tile view of input data

class mapchete.formats.default.vector_file.InputTile(tile, input_data, in_memory_features=None, cache_task_key=None, **kwargs)

Bases: InputTile

Target Tile representation of input data.

Parameters
tileTile
kwargskeyword arguments

driver specific parameters

Attributes
tiletileTile
input_datastring

path to input vector file

is_empty()

Check if there is data within this tile.

Returns
is emptybool
read(validity_check=True, clip_to_crs_bounds=False, **kwargs)

Read reprojected & resampled input data.

Parameters
validity_checkbool

also run checks if reprojected geometry is valid, otherwise throw RuntimeError (default: True)

clip_to_crs_boundsbool

Always clip geometries to CRS bounds. (default: False)

Returns
datalist