mapproxy-util(1)

โœจ mapproxy-util(1) โœจ โ€” the girlboss commandline tool for MapProxy ๐Ÿ’…

bestie. sit DOWN. we're learning mapproxy-util today and honestly? it's giving main character energy ๐Ÿ‘‘


๐ŸŽ€ NAME ๐ŸŽ€

mapproxy-util โ€” commandline tool for MapProxy. that's the whole vibe, no cap โœจ


๐Ÿซถ SYNOPSIS ๐Ÿซถ

mapproxy-util subcommand [OPTIONS]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so mapproxy-util is literally a little collection of sub-commands that are super helpful when you're working with MapProxy. it's your group chat of tooling ๐Ÿฆ‹

to get a list of all the sub-commands, just call it with nothing:

mapproxy-util

to actually call a sub-command:

mapproxy-util subcommand

and hey, every single sub-command has โœจloreโœจ โ€” extra info โ€” so if you're ever lost:

mapproxy-util subcommand --help

the current sub-commands are (the whole girl gang):


๐ŸŒธ CREATE ๐ŸŒธ

this sub-command creates example configurations for you. it's giving starter pack ๐ŸŽ there are templates for each configuration file.

  • -l, --list-templates โ€” list names of all available configuration templates. window shopping, but for config files ๐Ÿ›๏ธ
  • -t name, --template name โ€” create a configuration with the named template.
  • -f mapproxy.yaml, --mapproxy-conf mapproxy.yaml โ€” the path to the MapProxy configuration. required for some templates. don't forget it bestie ๐Ÿ˜ญ
  • --force โ€” overwrite any existing configuration with the same output filename. it's giving "no thoughts, just replace" ๐Ÿ’€

๐Ÿงš CONFIGURATION TEMPLATES ๐Ÿงš

available templates are:

  • base-config: creates an example mapproxy.yaml and seed.yaml file. you need to pass the destination directory to the command.
  • log-ini: creates an example logging configuration. you need to pass the target filename to the command.
  • wsgi-app: creates an example server script for the given MapProxy configuration (--f/--mapproxy-conf). you need to pass the target filename to the command.

โญ EXAMPLE โญ

mapproxy-util create -t base-config ./

๐Ÿ”ฅ SERVE-DEVELOP ๐Ÿ”ฅ

this sub-command starts a MapProxy instance of your configuration as a stand-alone server. it's your local little baby server, serving looks ๐Ÿ‘‘

you need to pass the MapProxy configuration as an argument. the server will automatically reload if you change the configuration or any of the MapProxy source code. obsessed with that glow-up-on-save behaviour โœจ

  • -b address, --bind address โ€” the server address where the HTTP server should listen for incoming connections. can be a port (:8080), a host (localhost) or both (localhost:8081). the default is localhost:8080. you need to use 0.0.0.0 to be able to connect to the server from external clients. yes, literally 0.0.0.0, no shortcuts ๐Ÿ’…

๐Ÿ’œ EXAMPLE ๐Ÿ’œ

mapproxy-util serve-develop ./mapproxy.yaml

๐ŸŒˆ SERVE-MULTIAPP-DEVELOP ๐ŸŒˆ

this sub-command is similar to serve-develop but it starts a MultiMapProxy instance. twins, but make it multi ๐Ÿ‘ฏ

you need to pass a directory of your MapProxy configurations as an argument. the server will automatically reload if you change any configuration or any of the MapProxy source code. iconic reload behaviour, fr fr โœจ

  • -b address, --bind address โ€” the server address where the HTTP server should listen for incoming connections. can be a port (:8080), a host (localhost) or both (localhost:8081). the default is localhost:8080. you need to use 0.0.0.0 to be able to connect to the server from external clients. again: external clients need 0.0.0.0, otherwise they simply cannot see you ๐Ÿ˜ญ

๐Ÿ“ EXAMPLE ๐Ÿ“

mapproxy-util serve-multiapp-develop my_projects/

๐Ÿฆ‹ SCALES ๐Ÿฆ‹

this sub-command helps to convert between scales and resolutions. it's the math girlie of the toolkit ๐Ÿงฎ

scales are ambiguous when the resolution of the output device (LCD, printer, mobile, etc) is unknown and therefore MapProxy only uses resolutions for configuration. so use the scales sub-command to calculate between known scale values and resolutions.

the command takes a list with one or more scale values and returns the corresponding resolution value.

  • --unit <m|d> โ€” return resolutions in this unit per pixel (default meter per pixel).
  • -l n, --levels n โ€” calculate resolutions for n levels. this will double the resolution of the last scale value if n is larger than the number of the provided scales.
  • -d dpi, --dpi dpi โ€” the resolution of the output display to use for the calculation. you need to set this to the same value of the client/server software you are using. common values are 72 and 96. the default value is the equivalent of a pixel size of .28mm, which is around 91 DPI. this is the value the OGC uses since the WMS 1.3.0 specification. (yes, we cite our sources, periodt ๐Ÿ’…)
  • --as-res-config โ€” format the output so that it can be pasted into a MapProxy grid configuration. copy-paste ready, we love a low-effort queen ๐Ÿซถ
  • --res-to-scale โ€” calculate from resolutions to scale. reversed, but make it fashion โœจ

๐Ÿ‘‘ EXAMPLE ๐Ÿ‘‘

for multiple levels as MapProxy configuration snippet:

mapproxy-util scales -l 4 --as-res-config 100000
res: [
     #  res            level        scale
       28.0000000000, #  0      100000.00000000
       14.0000000000, #  1       50000.00000000
        7.0000000000, #  2       25000.00000000
        3.5000000000, #  3       12500.00000000
]

with multiple scale values and custom DPI:

mapproxy-util scales --dpi 96 --as-res-config \
    100000 50000 25000 10000
res: [
     #  res            level        scale
       26.4583333333, #  0      100000.00000000
       13.2291666667, #  1       50000.00000000
        6.6145833333, #  2       25000.00000000
        2.6458333333, #  3       10000.00000000
]

๐Ÿ’… WMS-CAPABILITIES ๐Ÿ’…

this sub-command parses a valid capabilities document from a URL and displays all available layers. it's reading the roomโ€ฆ I mean, reading the service ๐Ÿ”

heads up bestie: this tool does not create a MapProxy configuration, but the output should help you to set up or modify your MapProxy configuration. it's inspo, not autopilot ๐Ÿ’–

the command takes a valid URL GetCapabilities URL.

  • --host URL โ€” display all available Layers for this service. each new layer will be marked with a hyphen and all sublayers are indented. it's giving nesting, and we respect the hierarchy ๐ŸŒธ
  • --version versionnumber โ€” parse the Capabilities-document for the given version. only version 1.1.1 and 1.3.0 are supported. the default value is 1.1.1.

๐Ÿ™ˆ EXAMPLE ๐Ÿ™ˆ

with the following MapProxy layer configuration:

layers:
  - name: osm
    title: Omniscale OSM WMS - osm.omniscale.net
    sources: [osm_cache]
  - name: foo
    title: Group Layer
    layers:
      - name: layer1a
        title: Title of Layer 1a
        sources: [osm_cache]
      - name: layer1b
        title: Title of Layer 1b
        sources: [osm_cache]

parsed capabilities document:

mapproxy-util wms-capabilities http://127.0.0.1:8080/service?REQUEST=GetCapabilities
Capabilities Document Version 1.1.1
Root-Layer:
  - title: MapProxy WMS Proxy
    url: http://127.0.0.1:8080/service?
    opaque: False
    srs: ['EPSG:31467', 'EPSG:31466', 'EPSG:4326', 'EPSG:25831', 'EPSG:25833',
          'EPSG:25832', 'EPSG:31468', 'EPSG:900913', 'CRS:84', 'EPSG:4258']
    bbox:
        EPSG:900913: [-20037508.3428, -20037508.3428, 20037508.3428, 20037508.3428]
        EPSG:4326: [-180.0, -85.0511287798, 180.0, 85.0511287798]
    queryable: False
    llbbox: [-180.0, -85.0511287798, 180.0, 85.0511287798]
    layers:
      - name: osm
        title: Omniscale OSM WMS - osm.omniscale.net
        url: http://127.0.0.1:8080/service?
        opaque: False
        srs: ['EPSG:31467', 'EPSG:31466', 'EPSG:25832', 'EPSG:25831', 'EPSG:25833',
              'EPSG:4326', 'EPSG:31468', 'EPSG:900913', 'CRS:84', 'EPSG:4258']
        bbox:
            EPSG:900913: [-20037508.3428, -20037508.3428, 20037508.3428, 20037508.3428]
            EPSG:4326: [-180.0, -85.0511287798, 180.0, 85.0511287798]
        queryable: False
        llbbox: [-180.0, -85.0511287798, 180.0, 85.0511287798]
      - name: foobar
        title: Group Layer
        url: http://127.0.0.1:8080/service?
        opaque: False
        srs: ['EPSG:31467', 'EPSG:31466', 'EPSG:25832', 'EPSG:25831', 'EPSG:25833',
              'EPSG:4326', 'EPSG:31468', 'EPSG:900913', 'CRS:84', 'EPSG:4258']
        bbox:
            EPSG:900913: [-20037508.3428, -20037508.3428, 20037508.3428, 20037508.3428]
            EPSG:4326: [-180.0, -85.0511287798, 180.0, 85.0511287798]
        queryable: False
        llbbox: [-180.0, -85.0511287798, 180.0, 85.0511287798]
        layers:
          - name: layer1a
            title: Title of Layer 1a
            url: http://127.0.0.1:8080/service?
            opaque: False
            srs: ['EPSG:31467', 'EPSG:31466', 'EPSG:25832', 'EPSG:25831', 'EPSG:25833',
                  'EPSG:4326', 'EPSG:31468', 'EPSG:900913', 'CRS:84', 'EPSG:4258']
            bbox:
                EPSG:900913: [-20037508.3428, -20037508.3428, 20037508.3428, 20037508.3428]
                EPSG:4326: [-180.0, -85.0511287798, 180.0, 85.0511287798]
            queryable: False
            llbbox: [-180.0, -85.0511287798, 180.0, 85.0511287798]
          - name: layer1b
            title: Title of Layer 1b
            url: http://127.0.0.1:8080/service?
            opaque: False
            srs: ['EPSG:31467', 'EPSG:31466', 'EPSG:25832', 'EPSG:25831', 'EPSG:25833',
                  'EPSG:4326', 'EPSG:31468', 'EPSG:900913', 'CRS:84', 'EPSG:4258']
            bbox:
                EPSG:900913: [-20037508.3428, -20037508.3428, 20037508.3428, 20037508.3428]
                EPSG:4326: [-180.0, -85.0511287798, 180.0, 85.0511287798]
            queryable: False
            llbbox: [-180.0, -85.0511287798, 180.0, 85.0511287798]

and that's not even the whole story bestieโ€ฆ more of this page is coming in part 2, so don't go anywhere ๐Ÿ’–

โœจ GRIDS โœจ

This sub-command is your lil tour guide for configured grids โ€” it spills all the tea about them. ๐Ÿซถ

You hand it a MapProxy configuration file and it hands you back all the grids you've configured.

And bestie, it doesn't leave you hanging either: if a grid doesn't explicitly define its default values, those defaults get shown anyway. All the default values are marked with an asterisk in the output so you can tell them apart at a glance. ๐Ÿ’…

  • -f path/to/config, --mapproxy-config path/to/config โ€” shows you all the configured grids for this MapProxy configuration, with all the detailed info. And if you don't set this option? The sub-command is gonna try to use the last argument as the mapproxy config instead. Sneaky but helpful. ๐Ÿ˜Œ
  • -l, --list โ€” just the names, no drama. Displays only the names of the grids for the given configuration, which are used by any grid.
  • --all โ€” show also grids that are not referenced by any cache. The wallflowers get their moment too. ๐Ÿฆ‹
  • -g grid_name, --grid grid_name โ€” narrow it down to info about a single grid only. Heads up though: the tool will exit if the grid name isn't found. No grid, no service. ๐Ÿ’€
  • -c coverage name, --coverage coverage name โ€” gives you an approximation of the number of tiles for each level that fall within this coverage. Important: the coverage must be defined in the Seed configuration.
  • -s seed.yaml, --seed-conf seed.yaml โ€” this one loads the seed configuration, and you need it if you're using the --coverage option. They're a package deal fr fr. ๐ŸŽ€

๐ŸŒŸ EXAMPLE ๐ŸŒŸ

Say your MapProxy grid configuration looks like this:

grids:
  localgrid:
    srs: EPSG:31467
    bbox: [5,50,10,55]
    bbox_srs: EPSG:4326
    min_res: 10000
  localgrid2:
    base: localgrid
    srs: EPSG:25832
    res_factor: sqrt2
    tile_size: [512, 512]

List all your configured grids:

mapproxy-util grids --list --mapproxy-config /path/to/mapproxy.yaml

And it goes:

GLOBAL_GEODETIC
GLOBAL_MERCATOR
localgrid
localgrid2

Now display detailed information for one specific grid:

mapproxy-util grids --grid localgrid --mapproxy-conf /path/to/mapproxy.yaml

And you get this absolute masterpiece of a report:

localgrid:
    Configuration:
        bbox: [5, 50, 10, 55]
        bbox_srs: 'EPSG:4326'
        min_res: 10000
        origin*: 'sw'
        srs: 'EPSG:31467'
        tile_size*: [256, 256]
    Levels: Resolutions, # x * y = total tiles
        00:  10000,             #      1 * 1      =        1
        01:  5000.0,            #      1 * 1      =        1
        02:  2500.0,            #      1 * 1      =        1
        03:  1250.0,            #      2 * 2      =        4
        04:  625.0,             #      3 * 4      =       12
        05:  312.5,             #      5 * 8      =       40
        06:  156.25,            #      9 * 15     =      135
        07:  78.125,            #     18 * 29     =      522
        08:  39.0625,           #     36 * 57     =   2.052K
        09:  19.53125,          #     72 * 113    =   8.136K
        10:  9.765625,          #    144 * 226    =  32.544K
        11:  4.8828125,         #    287 * 451    = 129.437K
        12:  2.44140625,        #    574 * 902    = 517.748K
        13:  1.220703125,       #   1148 * 1804   =   2.071M
        14:  0.6103515625,      #   2295 * 3607   =   8.278M
        15:  0.30517578125,     #   4589 * 7213   =  33.100M
        16:  0.152587890625,    #   9178 * 14426  = 132.402M
        17:  0.0762939453125,   #  18355 * 28851  = 529.560M
        18:  0.03814697265625,  #  36709 * 57701  =   2.118G
        19:  0.019073486328125, #  73417 * 115402 =   8.472G

๐Ÿ’– EXPORT ๐Ÿ’–

This sub-command exports tiles from one cache to another. It's giving seed tool energy, but with a glow-up: you don't have to go edit the configuration at all. The destination cache, the grid and the coverage can all be defined right there on the command line. Main character behaviour honestly. ๐Ÿ‘‘

Required arguments:

  • -f path, --mapproxy-conf path โ€” the path to the MapProxy configuration of the source cache.
  • --source name โ€” name of the source or cache to export.
  • --levels list โ€” a comma separated list of levels to export. You can also define a range of levels, because why not. For example '1,2,3,4,5', '1..10' or '1,3,4,6..8'. Look at you, being flexible. โœจ
  • --grid grid โ€” the tile grid for the export. The option can either be the name of the grid as defined in the in the MapProxy configuration, or it can be the grid definition itself. You can define a grid as a single string of the key-value pairs, and that grid definition supports all grid parameters. Peep the examples below for the vibe.
  • --dest destination โ€” where the export is headed. Can be a filename, a directory or a URL, depending on the export --type.
  • --type type โ€” choose the export type. Full list of all the options is right below. ๐Ÿ‘‡

Other options:

  • --fetch-missing-tiles โ€” whether MapProxy should request missing tiles from the source. By default, the export tool will only export existing tiles. So if you want the stragglers fetched, say so. ๐Ÿ™ˆ
  • --coverage coverage, --srs srs, --where where โ€” limit the export to this coverage. You can use a BBOX, WKT files or OGR datasources.
  • -c N, --concurrency N โ€” the number of concurrent export processes. Multitasking icon behaviour.

๐Ÿงš EXPORT TYPES ๐Ÿงš

  • tms โ€” Export tiles in a TMS like directory structure.
  • mapproxy, tc โ€” Export tiles like the internal cache directory structure. This is compatible with TileCache.
  • mbtile โ€” Exports tiles into a MBTile file.
  • arcgis โ€” Exports tiles in a ArcGIS exploded cache directory structure.

๐ŸŒธ EXAMPLE ๐ŸŒธ

Export tiles into a TMS directory structure under ./cache/. Limit export to the BBOX and levels 0 to 6.

mapproxy-util export -f mapproxy.yaml --grid osm_grid \
    --source osm_cache --dest ./cache/ \
    --levels 1..6 --coverage 5,50,10,60 --srs 4326

Export tiles into an MBTiles file. Limit export to a shape coverage.

mapproxy-util export -f mapproxy.yaml --grid osm_grid \
    --source osm_cache --dest osm.mbtiles --type mbtile \
    --levels 1..6 --coverage boundaries.shp \
    --where 'CNTRY_NAME = "Germany"' --srs 3857

Export tiles into an MBTiles file using a custom grid definition. Yes, you can just inline the whole grid. We love a self-sufficient string. ๐Ÿ’…

mapproxy-util export -f mapproxy.yaml --levels 1..6 \
    --grid "srs='EPSG:4326' bbox=[5,50,10,60] tile_size=[512,512]" \
    --source osm_cache --dest osm.mbtiles --type mbtile

And that's the whole page bestie, you ate that. ๐Ÿ’– This one's from the mapproxy-util(1) manual, dated 17 July 2026 โ€” go forth and export your little heart out. ๐ŸŽ€๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from