4.3.1.3 Raster image data exemplar (LAYER configuration)
An example of adding a PNG layer is included in the BGS_Bedrock_Raster_Map application. The relevant section is reproduced below for reference. This data was simply created as a raster from the bedrock shapefile for the purposes of serving as an example. In this case we won’t be setting up a response to GetFeatureInfo or GetLegendGraphic requests; we are just returning a coloured map. There is more detailed documentation (https://mapserver.org/input/raster.html), in particular as regards efficient serving of large images, using 8-bit vs. 24-bit images, tiling etc.
Example extract from map file below:
LAYER
NAME BGS_625k_BAR
TYPE RASTER
STATUS ON
DATA bedrock625ll.png
PROJECTION
“init=EPSG:4326”
END
PROCESSING "CLOSE_CONNECTION=DEFER"
METADATA
WMS_TITLE “GBR BGS 1:625k Bedrock Age”
WMS_ABSTRACT “GBR BGS 1:625k Bedrock Age”
WMS_SRS “EPSG:4326 EPSG:3857 CRS:84 EPSG:27700 EPSG:4258”
WMS_METADATAURL_HREF “http://.../geonetwork/srv/en/csw?SERVICE=CSW&VERSION=2.0.2
&REQUEST=GetRecordById&ID=ac9f8250-3ae5-49e5-9818-d14264a4fda4&”
WMS_METADATAURL_FORMAT “application/vnd.iso.19139+xml”
WMS_METADATAURL_TYPE “TC211”
WMS_DATAURL_HREF “http://www.bgs.ac.uk/discoverymetadata/13480426.html”
WMS_DATAURL_FORMAT “text/html”
WMS_KEYWORDLIST “OneGeology,bedrock,chronostratigraphy,continent@Europe,
subcontinent@Northern Europe,geographicarea@United Kingdom,DS_DATE@2011-06-15,age,
dataprovider@British Geological Survey,DS_TOPIC@geoscientificInformation,geology
serviceprovider@British Geological Survey,”
WMS_STYLE “default”
WMS_STYLE_DEFAULT_LEGENDURL_HEIGHT “353”
WMS_STYLE_DEFAULT_LEGENDURL_WIDTH “253”
WMS_STYLE_DEFAULT_LEGENDURL_HREF “http://.../BGS_Bedrock_Geology/bedrockAgeLegend.png”
# The legend URL must be accessible externally,
# So you cannot use ‘localhost’ or ‘127.0.0.1’ above.
WMS_STYLE_DEFAULT_LEGENDURL_FORMAT “image/png”
END
TOLERANCE 10
DUMP TRUE
END #layer
Section last modified: 20 June 2011
