コード例 #1
0
ファイル: config.py プロジェクト: Milk-oolong/mapchete
def get_zoom_levels(process_zoom_levels=None, init_zoom_levels=None):
    """Validate and return zoom levels."""
    process_zoom_levels = validate_zooms(process_zoom_levels)
    if init_zoom_levels is None:
        return process_zoom_levels
    else:
        init_zoom_levels = validate_zooms(init_zoom_levels)
        if not set(init_zoom_levels).issubset(set(process_zoom_levels)):
            raise ValueError("init zooms must be a subset of process zoom")
        return init_zoom_levels
コード例 #2
0
ファイル: utils.py プロジェクト: Milk-oolong/mapchete
def _validate_zoom(ctx, param, zoom):
    if zoom:
        try:
            zoom_levels = list(map(int, zoom.split(",")))
        except ValueError:
            raise click.BadParameter("zoom levels must be integer values")
        try:
            if len(zoom_levels) > 2:
                raise ValueError("zooms can be maximum two items")
            return validate_zooms(zoom_levels, expand=False)
        except Exception as e:
            raise click.BadParameter(e)
コード例 #3
0
ファイル: convert.py プロジェクト: robert-werner/mapchete
def _input_mapchete_info(input_):
    conf = raw_conf(input_)
    output_params = conf["output"]
    pyramid = raw_conf_output_pyramid(conf)
    return dict(
        output_params=output_params,
        pyramid=pyramid.to_dict(),
        crs=pyramid.crs,
        zoom_levels=validate_zooms(conf["zoom_levels"], expand=False),
        pixel_size=None,
        input_type=OUTPUT_FORMATS[output_params["format"]]["data_type"],
        bounds=conf.get("bounds"))
コード例 #4
0
ファイル: _core.py プロジェクト: robert-werner/mapchete
def _get_zoom_level(zoom, process):
    """Determine zoom levels."""
    return reversed(
        process.config.zoom_levels) if zoom is None else validate_zooms(zoom)
コード例 #5
0
ファイル: config.py プロジェクト: Milk-oolong/mapchete
 def zoom_levels(self):
     """Process zoom levels as defined in the configuration."""
     return validate_zooms(self._raw["zoom_levels"])