Thursday, 14 December 2017

wms - How do I create a mapserver config file for tiles downloaded from WMTS service?


I have downloaded Austria official map tiles from http://www.basemap.at/index_en.html using the provided offline downloader tool. Tiles are stored in my hard disk with paths similar to ///.png .


I now need to create a .map configuration file for mapserver, however all I have is the GetCapabilities result from the provider: http://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml .


Being new to GIS, I am unsure about whether I can manually create a MapServer .map file from scratch based on the GetCapabilities information, or if there is any tool or approach I shall use.


What is the preferred approach to create a .map file for a given set of downloaded raster tiles?



Answer



Current QGIS .MAP export plugin (RT MapServer Exporter) was difficult to install on Windows 64 bit and yet, the resulting MAP file does not suit my needs.



The solution for me is to:


1) Downloaded tiles using the tool in the Basemap.AT page. Ensure you enable the checkbox in order to generate the .pgw files, which define the geographical location of each .png tile.


2) From the downloaded tiles, for each zoom level (in directories named '1', '2', '3'...), created a "tileindex" shape file (.shp) that indexes the tiles for that level. This is done using the gdaltindex tool:


gdaltindex 1.shp `find 1 -name '*.png'`
gdaltindex 2.shp `find 2 -name '*.png'`
...

3) Mapserver can use these shape files to serve a map. I manually constructed the map file. You need to define several levels and play with the MAXSCALEDENOM and MINSCALEDENOM on each level to show the appropriate tileset at the correct scale (I defined scale levels by looking at the original tileset metadata).


The resulting MapServer configuration file (.MAP) contains layers that look like:


  [...]


LAYER # Main
NAME city_geoland
TYPE RASTER
END # Main

LAYER
NAME city_geoland_5
TYPE RASTER
TILEINDEX "5"

TILEITEM "LOCATION"
MINSCALEDENOM 8735659

METADATA
WMS_TITLE "City Area Basemap Level 5"
WMS_ABSTRACT ""
WMS_SRS "EPSG:3857"
END
END


LAYER
NAME city_geoland_6
TYPE RASTER
TILEINDEX "6"
TILEITEM "LOCATION"
MAXSCALEDENOM 8735659
MINSCALEDENOM 4367830

METADATA
WMS_TITLE "City Area Basemap Level 6"

WMS_ABSTRACT ""
WMS_SRS "EPSG:3857"
END
END

[...]

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...