Skip to content

MVW MapServer mapfiles

Grace-Amondi edited this page Apr 24, 2021 · 2 revisions

MVW MapServer mapfiles

OsGeo MapServer is the main GIS engine to provide geographical layers to the MapViewer.

All the mapfiles used by Mukau reside in ./mapserver/mapfiles/mukau/ and include from subdirectories /classifications/ and /config/ pieces of code defining classes and shared settings respectively. Two mapfiles are present in the current instance of Mukau, base.map and mukau.map.

base.map is the mapfile containing functional layers and layers loading geographical background data. In this version of Mukau, such layers are:

  • landmass-sea: used to display continental land masses in the MapViewer's base layer named "Continent".
  • ne_relief: used to load raster images of Natural Earth II with Shaded Relief and Water for the MapViewer's base layer named "Natural Earth".
  • Coastlines and Tiny coastlines: for the MapViewer layer "Coastlines" load coast profiles from COASTS and COASTLINES PostgreSQL tables respectively: the former for scales < 5000000, the latter for scales > 5000000.
  • Water surfaces: for the MapViewer layer "Surface Water Bodies" loads water body polygons from SURFACE_WATER PostgreSQL table, whose data source is FAO RWDB2 Surface Water Bodies.
  • Rivers: for the MapViewer layer "Rivers" loads river line strings of major rivers and perennial rivers from FAO_RWDB_RIVERS PostgreSQL table, whose data source is FAO RWDB2 River-Surface Water Body Network.
  • Countries: loads country boundaries from COUNTRIES PostgreSQL table for the MapViewer layer "Countries".
  • urb_areas: loads shapefiles of Natural Earth Urban Areas for the MapViewer layer "Urban Areas".
  • Towns: for the MapViewer layer "Towns" loads points of major towns from POPULATED_PLACES PostgreSQL table, whose data source is Natural Earth Populated Places.
  • All fao_[theme_name] layers load data for the MapViewer layer "FAO Land Management". This layer is a multi-theme layer, i.e. it is a collection of different themes that can be selected right-clicking on the layer name. When a theme is selected, the correspondent fao_[theme_name] layer of base.map is activated in order to display the data of such a theme, retrieved from the correspondent column of GRID_083DD PostgreSQL table. For example, selecting "Land Use Type" as a theme, the layer fao_landuse_type is switched on and data of column GRID_083DD.LUO_ID is visualized. Other available themes are Dominant Crops, Growing Period, Infant Mortality, Irrigation, Livestock Types, Population Density, Soil Types, Slope Types, and Thermal Regimes.
  • highlight and int_highlight: functional layers used to display MAPSERVER_SELECTED, i.e. the PostgreSQL table where geographical features are temporarily inserted to be highlighted within the MapViewer after a "Zoom to", "Go to" or "Identify" (query) functions.

mukau.map is the mapfile aimed to contain the definition of layers presenting thematic indicators and/or concerning the main topic of the current installation of the system. In the current version of Mukau, its layers are:

  • Monthly Precipitation: MapServer counterpart of the MapViewer's "Monthly Precipitation (mm/month)" layer. Data are taken from PostgreSQL with a join between the spatial table GRID_1DD and the thematic view GRID_1DD_GPPC_YEAR. The requested period is set through the two variables %SELECTED_YEAR% and %SELECTED_MONTH%. The retrieved values are drawn according to the continuous classification defined in /mapfiles/mukau/classification/rainfall.classes.map. Precipitation data are provided by the Global Precipitation Climatology Centre (GPCC) of the Deutscher Wetterdienst.
  • SPI 1 dd: MapServer counterpart of the MapViewer's "SPI 1 dd" layer. Data of the Standardized Precipitation Index (SPI) are available for seven-time scales (1, 3, 6, 9, 12, 24, and 48 months) and are taken from PostgreSQL with a join between the spatial table GRID_1DD and the thematic table GRID_1DD_SPI. Requested period and timescale are set through the three variables %SELECTED_YEAR%, %SELECTED_MONTH% and %SELECTED_TIMESCALE%. The retrieved values are drawn according to the classes defined in /mapfiles/mukau/classification/spi.classes.map.
  • dates: functional layer to display the reference date of a thematic layer in the top-left corner of a map provided via WMS GetMap request.

The following pieces of mapfile, included by both base.map and mukau.map, and placed into /mapfiles/mukau/config/ are also quite important:

  • mpu.icn.map: contains CONNECTIONTYPE and CONNECTION, the two mapfile references necessary to connect a PostgreSQL/PostGIS table. DB host, DB name, accessing user and password must be specified here. You can connect to any other PostgreSQL/PostGIS database by replacing on the file:
CONNECTIONTYPE POSTGIS
CONNECTION "host=<yourhost> dbname=<yourdbname> user=<yourdbuser> password=<yourdbuserpassword> port=<yourdbport>"

As a recommendation, you can create other mpu.icn.map-like files and save it as <yourdbname>.map, so you can have as many *.map files as databases you want to connect to the Mukau MapViewer. Later, on the ./mapserver/mapfiles/mukau/mukau.map or ./mapserver/mapfiles/mukau/base.map files, for a specific layer you can replace the INCLUDE parameter as INCLUDE "./config/mpu.icn.map" with INCLUDE "./config/<yourdbname>.map". In this way, MapServer will connect <yourdb> instead of the local PostgreSQL/PostGIS Mukau database. Remember to check/change/add the SQL query on the DATA parameter.

Warning: The database to be connected to the Mukau MapViewer should have open all the ports necessary to allow it to be accessible by other machines. This is done by changing the postgresql.conf file on # CONNECTIONS AND AUTHENTICATION section. For details, please read: https://www.postgresql.org/docs/9.6/runtime-config-connection.html

  • ows.shared.map: fragment of the WEB object's METADATA object containing parameters to set the WMS service provided by MapServer. During the installation protocol, hostname and port must be specified here.
  • disable.wms.shared.map: the "wms_enable_request" metadata entry has been isolated here in order to easily enable or disable WMS requests.

Clone this wiki locally