mapshader.sources.MapSource#
- class mapshader.sources.MapSource(name=None, description=None, filepath=None, legend=None, config_path=None, data=None, geometry_type=None, key=None, text=None, fields=None, span=None, route=None, geometry_field='geometry', xfield='geometry', yfield='geometry', zfield=None, agg_func=None, raster_interpolate='linear', shade_how='linear', cmap=mapshader.colors.colors.viridis, color_key=None, dynspread=None, extras=None, raster_padding=0, service_types=None, full_extent=None, storage_options=None, region_of_interest=None, default_extent=None, default_height=256, default_width=256, overviews=None, transforms=None, band=None, attrs=None, preload=False, force_recreate_overviews=False, tiling=None)[source]#
This class represents a map source object.
- Parameters:
name (str) – Service name.
description (str) – Service description.
filepath (str) – Relative path to the data file.
legend (list of dict) – Service legend, which could be defined the name, color, value, and category.
config_path (str) – Relative path to the config file.
data (geopandas.GeoDataFrame) – Service source data.
geometry_type (str) – Geometry type.
key (str) – Service route root.
text (str) – The service introduction text.
fields (list of str) – The geometry fields.
span (str or tuple of int;) – Min and max data values to use for colormap/alpha interpolation when wishing to override autoranging.
geometry_field (str, default=geometry) – The geometry field name.
xfield (str, default=geometry) – The x field name.
yfield (str, default=geometry) – The y field name.
zfield (str) – The z field name.
agg_func (str) – Reduction to compute.
raster_interpolate (str, default=linear) – Resampling mode when upsampling raster. Options include: nearest, linear.
shade_how (str, default=linear) – The interpolation method to use. Valid strings are ‘eq_hist’, ‘cbrt’, ‘log’, and ‘linear’.
cmap (list of colors or matplotlib.colors.Colormap, default=viridis) – The colormap to use for 2D agg arrays.
color_key (dict or iterable) – The colors to use for a 3D (categorical) agg array.
dynspread (int) – The maximum number of pixels to spread on all shape sides.
extras (list of str) – The additional transforms over the data, which options could be ‘hillshade’ or ‘quantile’.
raster_padding (int, default=0) – The padding to be added over the coordinates bounds range.
service_types (list of str) – The service types, which options could be ‘tile’, ‘image’, ‘wms’, and ‘geojson’.
full_extent (tuple of int) – The coordinate of the lower left corner and the coordinate of the upper right corner in map units.
default_extent (list of int) – The service starting extent.
default_height (int, default=256) – Height of the output aggregate in pixels.
default_width (int, default=256) – Width of the output aggregate in pixels.
overviews (dict) – The factors and values to be used when reducing the data resolution.
transforms (list of dict) – The transforms to be applied over the data, which options could include: ‘reproject_raster’, ‘reproject_vector’, ‘orient_array’, ‘cast’, ‘flip_coords’, ‘build_raster_overviews’, ‘build_vector_overviews’, ‘squeeze’, ‘to_spatialpandas’, ‘add_xy_fields’, ‘select_by_attributes’, ‘polygon_to_line’, and ‘raster_to_categorical_points’.
preload (bool, default=False) – Preload the data after the service started.
force_recreate_overviews (bool, default=False) – For overviews to be recreated even if they already exist.
tiling (dict, default=None) – Settings for saving tile images to an output location
- __init__(name=None, description=None, filepath=None, legend=None, config_path=None, data=None, geometry_type=None, key=None, text=None, fields=None, span=None, route=None, geometry_field='geometry', xfield='geometry', yfield='geometry', zfield=None, agg_func=None, raster_interpolate='linear', shade_how='linear', cmap=mapshader.colors.colors.viridis, color_key=None, dynspread=None, extras=None, raster_padding=0, service_types=None, full_extent=None, storage_options=None, region_of_interest=None, default_extent=None, default_height=256, default_width=256, overviews=None, transforms=None, band=None, attrs=None, preload=False, force_recreate_overviews=False, tiling=None)[source]#
Methods
__init__
([name, description, filepath, ...])from_obj
(obj)load
()Load the service data.
Attributes
load_func