|
| 1 | +# Map export |
| 2 | + |
| 3 | +The [MapExport](../references/qwc2_plugins.md#mapexport) plugin allows exporting a selected portion of the map to a variety of formats, as supported by the QGIS Server, among which: |
| 4 | + |
| 5 | +* Image formats (`image/png`, `image/jpeg`, `image/geotiff`, ...) |
| 6 | +* DXF (`application/dxf`) |
| 7 | +* GeoPDF (`application/pdf`) |
| 8 | + |
| 9 | +See the [MapExport plugin reference](../references/qwc2_plugins.md#mapexport) for a list of configuration options. |
| 10 | + |
| 11 | +In particular, the plugin supports specifying different export configurations for each format, i.e.: |
| 12 | +``` |
| 13 | + { |
| 14 | + "name": "MapExport", |
| 15 | + "cfg": { |
| 16 | + "formatConfiguration": { |
| 17 | + "application/dxf": [ |
| 18 | + {"name": "default"}, |
| 19 | + { |
| 20 | + "name": "Geobau", |
| 21 | + "extraQuery": "LAYERS=dxfgeobau", |
| 22 | + "formatOptions": "MODE:NOSYMBOLOGY" |
| 23 | + } |
| 24 | + ], |
| 25 | + "image/png": [ |
| 26 | + {"name": "default"}, |
| 27 | + {"name": "With baselayer", "baseLayer": "SWISSIMAGE"} |
| 28 | + ] |
| 29 | + } |
| 30 | + } |
| 31 | + }, |
| 32 | +``` |
| 33 | + |
| 34 | +For each format, if multiple configurations are defined, a combobox will be displayed to choose an export configuration. |
| 35 | + |
| 36 | +## Export to image formats |
| 37 | +For image formats, it may be desired to override the background layer for the exported map. To this end, specify a `baseLayer` in the format configuration to the name of a background `printLayer`. |
| 38 | + |
| 39 | +For GeoTIFF image export to become available, set up the `wms_geotiff_output` [QGIS Server plugin](https://github.com/qwc-services/qwc-qgis-server-plugins): |
| 40 | + |
| 41 | +```yml |
| 42 | + qwc-qgis-server: |
| 43 | + image: docker.io/sourcepole/qwc-qgis-server:<TAG> |
| 44 | + volumes: |
| 45 | + - ./volumes/qgis-server-plugins/wms_geotiff_output:/usr/share/qgis/python/plugins/wms_geotiff_output:ro |
| 46 | + ... |
| 47 | +``` |
| 48 | + |
| 49 | +# DXF export |
| 50 | +To enable the DXF export format, the desired layers are marked as *Published* in the QGIS Project Properties &to; QGIS Server &to; WFS/OAPIF. |
| 51 | + |
| 52 | +You can configure the DXF export by passing supported [`FORMAT_OPTIONS`](https://docs.qgis.org/latest/en/docs/server_manual/services.html#wms-formatoptions) as `formatOptions`, i.e. |
| 53 | + |
| 54 | + "formatOptions": "MODE:NOSYMBOLOGY;NO_MTEXT:1" |
| 55 | + |
| 56 | +# GeoPDF export |
| 57 | +GeoPDF export is available since QGIS Server 3.36. As opposed generating a PDF via `GetPrint` (as used by the `Print`-Plugin), the MapExport plugin generates the GeoPDF via `GetMap` and will return just the selected export area as a GeoPDF, without relying on any print layout defined in the QGIS project. |
| 58 | + |
| 59 | +You can configure the GeoPDF export by passing supported `FORMAT_OPTIONS`, look for `PdfFormatOption` in [https://github.com/qgis/QGIS/blob/master/src/server/services/wms/qgswmsparameters.h](https://github.com/qgis/QGIS/blob/master/src/server/services/wms/qgswmsparameters.h). |
0 commit comments