melowntech / vts-mapproxy

VTS Mapproxy
BSD 2-Clause "Simplified" License
30 stars 5 forks source link

Automate resource preparation using a script and make it part of the package. #4

Closed ladislavhorky closed 5 years ago

ladislavhorky commented 6 years ago

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.

ladislavhorky commented 6 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

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:

vaclavblazek commented 5 years ago

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.