Closed ladislavhorky closed 5 years ago
Basic outline
Jachym's script is pretty fine, only the interface needs to be polished and logging added. Plus it needs to handle orthophoto as well.
Proposed usage is to have some base data at dataset/my-dem/dem.tif
which would be --input
of the script. The default --output
will be the parent dir: dataset/my-dem
. Once the script finishes the dataset/my-dem
will contain prepared dataset plus it's configuration resource.json
whose path I will include to the main resource config file to make mapproxy serve it.
Differences from original Jachym's script:
Logging
--log.file
option and optional --log.mask
option, both to be passed to underlying
tools. That way all tool will append their logs to this file. The logging should get easier once we get to deploy dbglog package for python.
Parameters
Generally the script should shadow important parameters of underlying tools together with sensible defaults + some resource configuration params. Regarding existing parameters in the script:
--input, --output
: see above.--size
: remove, --tileSize
with default 4096x4096 in generatevrtwo
is fine for most cases.--refframe
: rename to --referenceFrame
to correspond with mapproxy-tiling
and mapproxy-calipers
parameter.--group
, --comment
, --id
: leave as is.-o
: rename to --overwrite
-v
: remove, see Logging on how it should be done.-u
: remove, this usecase is too special.--datasetType
: add, either dem
or ophoto
to distinguish between two types of input.Implemented as a native mapproxy-setup-resource
tool.
Command line options:
--referenceFrame arg Reference frame.
--id arg Resource ID. Deduced from filename if
not provided.
--group arg Resource group ID. Deduced from
filename if not provided.
--dataset arg Path to input raster dataset.
--resourceType arg Resource type: TMS or TIN.
--tin.geoidGrid arg TIN: Geoid grid to inject into
dataset's SRS. Defaults to reference
frame's body default geoid grid if not
specified.
--tms.format arg (=jpg) TMS: image format to use when
generating tiles (jpg or png).
--tms.resampling arg TMS: GDAL resampling used to generate
tiles. One of [nearest, bilinear,
cubic, cubicspline, lanczos, average,
mode, minimum, maximum, median, q1, q3,
texture, dem].
--tms.transparent arg (=0) TMS: mark tiles as trasnparent.
--credits.firstNumericId arg (=32768) First numeric ID of the auto-generated
credits.
--attribution arg Atribution text, one per attribution.
At least one attribution is required.
Configuration options:
--mapproxy.dataRoot arg Path to mapproxy resource data root
directory.
--mapproxy.definitionDir arg Path to mapproxy resource definition
directory.
--mapproxy.ctrl arg Path to mapproxy control socket.
NB: This tool needs to know where mapproxy stores resource definitions, datasets and how to communicate with running mapproxy. Easiest way to use it is via vts-backend project where it is fully configured and ready to use.
Preparing mapproxy resource is a bit tedious task that can be easily automated by a script, at least for basic usage.
The rough version of such script is here: https://github.com/Melown/vts-mapproxy/blob/master/mapproxy/scripts/mapproxy-dem2dataset
Create polished version of such script working for DEMs, orthophotos (and vectors?) and make it part of mapproxy package.