mapchete.formats.default.png_hillshade module

Special PNG process output for hillshades.

Writes inverted hillshade into alpha channel of black image, so that hillshade can be used as overlay over other data.

output configuration parameters

mandatory

path: string

output directory

optional

nodata: integer or float

nodata value used for writing

class mapchete.formats.default.png_hillshade.OutputDataReader(output_params, **kwargs)

Bases: TileDirectoryOutputReader

PNG_hillshade output class.

Parameters
output_paramsdictionary

output parameters from Mapchete file

Attributes
pathstring

path to output directory

file_extensionstring

file extension for output files (.tif)

output_paramsdictionary

output parameters from Mapchete file

old_band_numbool

in prior versions, 4 channels (3x gray 1x alpha) were written, now 2 channels (1x gray, 1x alpha)

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': 'raster', 'driver_name': 'PNG_hillshade', 'mode': 'w'}
empty(process_tile)

Return empty data.

Parameters
process_tileBufferedTile

must be member of process TilePyramid

Returns
empty dataarray or list

empty array with correct data type for raster data or empty list for vector data

for_web(data)

Convert data to web output.

Parameters
dataarray
Returns
MemoryFile(), MIME type
is_valid_with_config(config)

Check if output format is valid with other process parameters.

Parameters
configdictionary

output configuration parameters

Returns
is_validbool
profile(tile=None)

Create a metadata dictionary for rasterio.

Parameters
tileBufferedTile
Returns
metadatadictionary

output profile dictionary used for rasterio.

read(output_tile, **kwargs)

Read existing process output.

Parameters
output_tileBufferedTile

must be member of output TilePyramid

Returns
process outputBufferedTile with appended data
class mapchete.formats.default.png_hillshade.OutputDataWriter(output_params, **kwargs)

Bases: OutputDataWriter, OutputDataReader

METADATA = {'data_type': 'raster', 'driver_name': 'PNG_hillshade', 'mode': 'w'}
write(process_tile, data)

Write data from process tiles into PNG file(s).

Parameters
process_tileBufferedTile

must be member of process TilePyramid