1

I have some processing that runs on my machine producing between five to ten rasters layer a day. I want to serve these layers using MapServer.

I initially start with a folder that has 300 raster layers all defined in the Mapfile. In the end I could end up with + - 1500 images. How can I serve these layers and incrementally add each new file generated to the Mapfile?

I notice that the more images I have the larger the Mapfile. Any reference to documentation and examples is welcome. Can I use variables to define my Mapfile layers. All these raster layer have a simple raster style.

0

Your MapServer .map file doesn't have to be a single file, you can build it up by including other templates, and the templates can include other files etc.

So here for example is a Layer file (Kerasia_TF_PS.map) that includes information that is common to other layers in a service...

LAYER
    DATA "Kerasia_TF_PS_TS"
    EXTENT 21.6745814622 39.3001960995 21.7239223074 39.3448554782
    NAME "GRC_Kerasia_ESA_EN_5k_psi_TS"
    PROJECTION
        #Projection of the data itself
        "init=epsg:4258"
    END
    METADATA
        "OWS_ABSTRACT" "Terrafirma PSI data for the Kerasia region of Greece"
        "OWS_DATAURL_HREF" "http://ogc.bgs.ac.uk/BGS_ESA_EN_Terrafirma/docs/reports/Kerasia_TF_PS_110408 PSI Processing Report_Kerasia.pdf"
        "OWS_KEYWORDLIST" "processedby@GAMMA Remote Sensing,serviceprovider@British Geological Survey,dataprovider@European Space Agency,PSI,ESA,Terrafirma,DS_TOPIC@geoscientificinformation,continent@Europe,subcontinent@Southern Europe,geographicarea@Greece,subarea@Kerasia,DS_DATE@2011-02-28"
        "OWS_EXTENT" "21.6745814622 39.3001960995 21.7239223074 39.3448554782"
        "OWS_METADATAURL_HREF" "http://ogc.bgs.ac.uk/terrafirma/metadata/Kerasia_TF_PS_metadata.xml"
        "OWS_TITLE" "GRC Kerasia ESA 1:5000 PSI time series"
        "OWS_SRS" "CRS:84 EPSG:4258 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4326 EPSG:900913"

        "WFS_SRS" "EPSG:4258"

        # GENERIC LAYER 'METADATA' CONFIG FOLLOWS
        INCLUDE "generic-layer-meta-config.map"
    END

    TEMPLATE "tmpl/Kerasia_TF_PS_body.html"

    # GENERIC LAYER CONFIG FOLLOWS
    INCLUDE "generic-layer-config.map"

    # GENERIC SYMBOLIZATION CONFIG FOLLOWS
    INCLUDE "velocity-classification.map"

END

Then this file can itself be included like:

MAP
    CONFIG "MS_ERRORFILE" "D:/logs/MapServer/Pub/TFL/ms_error.log"
    CONFIG "PROJ_LIB" "C:/apps/gisinternals/bin/proj/SHARE"
    DEBUG 0
    NAME "BGS_ESA_EN_TERRAFIRMA"
    EXTENT -9.3790866 32.5177656 37.848765991 63.1478639909
    FONTSET "../DefaultMapIncludes/fontset.lst"
    INCLUDE "../DefaultMapIncludes/BGS-service-std-output-plus1.map"
    IMAGEQUALITY 95
    LEGEND
        IMAGECOLOR 255 255 255
        STATUS ON
        KEYSIZE 18 12
        LABEL
            TYPE BITMAP
            SIZE MEDIUM
            COLOR 0 0 89
        END
    END
    MAXSIZE 3072
    PROJECTION
    # The DEFAULT SERVICE projection
        "init=epsg:4258"
    END
    SHAPEPATH "data"
    SIZE 800 600
    STATUS ON
    SYMBOLSET "../DefaultMapIncludes/symbols.sym"
    UNITS dd
    WEB
        FOOTER "tmpl/query_footer.html"
        HEADER "tmpl/query_header.html"
        IMAGEPATH "D:/WxS/ms/out/tmp/"
        IMAGEURL "/ms_tmp/"
        METADATA
            INCLUDE "../DefaultMapIncludes/BGS-service-contacts.map"
            INCLUDE "../DefaultMapIncludes/BGS-ServiceMetadata.map"
            "OWS_ABSTRACT" "This web service provides access to Terrafirma legacy data as WMS and WFS.  Terrafirma is a project that originated within the GMES (Global Monitoring for Environment and Security) Service Element (GSE) programme of the European Space Agency, under the name Geohazard Land Motion (Terrafirma) Services."
            "OWS_ACCESSCONSTRAINTS" "This service is for non-commercial use only. Neither the PSI datasets nor any results derived from this Terrafirma data may be used for commercial purposes.  For full terms and conditions for use of the data please see: http://ogc.bgs.ac.uk/BGS_ESA_EN_Terrafirma/docs/141219_TF 1GE_Terms Conditions_v3.pdf"
            "OWS_ENABLE_REQUEST" "*"
            "OWS_FEES" "none"
            "OWS_KEYWORDLIST" "MD_LANG@ENG,MD_DATE@2014-06-09,Terrafirma,PSI,ESA,GMES,ground motion,hazard"
            "OWS_SERVICE_ONLINERESOURCE" "http://www.terrafirma.eu.com/"
            "OWS_SRS" "CRS:84 EPSG:4258 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4326 EPSG:900913"
            "OWS_TITLE" "Terrafirma PSI legacy data service"
            "OWS_UPDATESEQUENCE" "2014-11-05T15:43:00Z"
            "WMS_BBOX_EXTENDED" "TRUE"
            "WMS_FEATURE_INFO_MIME_TYPE" "text/html"
            "WMS_GETFEATUREINFO_FORMATLIST" "text/html,application/vnd.ogc.gml,text/xml"
            INCLUDE "../DefaultMapIncludes/BGS-service-embedded-INSPIRE.map"
            "WMS_INSPIRE_METADATADATE" "2014-03-28"
            "WMS_INSPIRE_RESOURCELOCATOR" "http://ogc.bgs.ac.uk/cgi-bin/TFL-PSI/ows?"
            "WMS_INSPIRE_TEMPORAL_REFERENCE" "2014-06-06"
            "WMS_ROOTLAYER_TITLE" "Terrafirma PSI data service"
        END
    END
    # LAYER SPECIFIC CONFIG FOLLOWS
    ...
    INCLUDE "Kerasia_TF_PS.map"    
    ...
END

In your case you might want to include in your service map file a file which holds a list of layer definition (files), then programmatically create a layer file for each or your new raster layers and then recreate the list of layer files including the one for your new layer.

0

I don't think so variables would help much.

You may use INCLUDE directive in map file to have simpler map file structure. Create each layer definitions in a separate file and include them in the main map file. So you have to make a copy of a layer definition map file, replace the raster name and path in it and add a new row to the master map file (e.g. INCLUDE 'new_file').

You can write script or use C pre-processor to automatize the process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.