[mapserver-users] How to use/offer multiple projections in mapfile for WMS

Stefan Schwarzer stefan.schwarzer at unep.org
Tue Jan 21 22:57:36 PST 2014


Hi there,

I'd like to offer multiple projections for my WMS layers. But it doesn't work the way I want. 

The EPSG:4326 works well. But when I change it to, for example, EPSG: 3395, I get an empty image (the legend shows).

I have to define the projection at various places - already a bit confusing for me. And I have a projection in the SQL query: "…. USING srid= 4326". Tried to replace that one too, but didn't change anything.

Thanks for any suggestions!

Stefan

 
        MAP
        
            # Map definition ---------------------
            
            NAME wms_test.map
            STATUS ON
            SIZE 600 300
            EXTENT -180 -90 180 90
            UNITS DD
            IMAGECOLOR 255 255 255
            SHAPEPATH 'xx' 
            FONTSET 'xx' 
            SYMBOLSET 'xx' 
            IMAGETYPE png
            DATAPATTERN '^[0-9]'
            

            PROJECTION
                'init=epsg:4326'
            END


            
            WEB
                IMAGEPATH '/www/geodataportal/temp/'
                IMAGEURL 'http://129.194.231.185/temp/'
                METADATA
                    'wms_title'                             'Environmental Data Explorer WMS Server'
                    'wms_service_onlineresource'    'http://129.194.231.185/cgi-bin.main?map=/www/geodataportal/htdocs/mod_map/wms_test.map&'
                    'wms_getfeatureinfo'                'http://129.194.231.185/cgi-bin.main?map=/www/geodataportal/htdocs/mod_map/wms_test.map&'
                    'wms_featureinfoformat'             'text/plain'
                    'wms_abstract'                          '...'
                    'wms_accessconstraints'             '...'
                    'wms_country'                           'Switzerland'
                    'wms_city'                              'Geneva'
                    'wms_postcode'                      '1211'
                    'wms_address'                           '11, Chemin des Anémones'
                    'wms_contactperson'                 '-'
                    'wms_addresstype'                   '-'
                    'wms_stateorprovince'               'Geneva'
                    'wms_contactelectronicmaliaddress' 'geo_team ---at--- grid.unep.ch'
                    'wms_contactorganization'           'UNEP/DEWA/GRID-Europe'
                    'wms_keywordlist'                   'download, environment, geo, data, water, map, graph, world, population, unep, emission, temperature, biodiversity, forest, consumption, vegetation, land, statistics, energy, soil'
                    'ows_enable_request'            '*' 
                    'wms_srs'                       'EPSG:4326 EPSG:3395'
                    'ows_srs'                       'EPSG:4326 EPSG:3395'
                END
            END
            



        LAYER
            NAME agri_area  
            METADATA 
                'wms_title'         'Agricultural Area'
                'wms_abstract'       'Units: Square Kilometers'
                'wms_timeextent'    '2011'
                'wms_extent'        '-180 -90 180 90' 
                'wms_srs'           'EPSG:4326 EPSG:3395' 
                'wms_include_items' 'name,value' 
            END # METADATA
            #PROJECTION
            #    'init=epsg:4326'
            #END
            STATUS OFF
            CONNECTIONTYPE postgis
            CONNECTION 'user=xx password=xx dbname=xx'           
            TYPE POLYGON
            DATA "geom FROM (query-here) AS foo USING UNIQUE uid USING srid= 4326" 
            TEMPLATE 'dummy'
            DUMP TRUE
            CLASSITEM 'value'
            CLASS
                NAME 'Agricultural Area [2011]'
                EXPRESSION ([value]=-10001)
                TEMPLATE 'empty space'
            END  # CLASS 
            CLASS
                NAME 'Square Kilometers' 
                EXPRESSION ([value]=-110003)
                TEMPLATE 'units as title in legend'
            END  # CLASS                
            CLASS
                NAME 'no data'
                EXPRESSION ([value]=-9999)
                COLOR 230 230 230
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
            END  # CLASS
            CLASS 
                NAME '4 to 1038299'
                EXPRESSION ([value]<=1038299)
                COLOR 255 255 178
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
                LABEL
                    FONT arial
                    TYPE truetype
                    ANTIALIAS false
                    SIZE 8
                    COLOR 0 0 0
                    POSITION AUTO
                    PARTIALS FALSE
                    FORCE true
                    OFFSET 0 5
                    #OUTLINECOLOR 150 150 150
                END
            END  # CLASS 
            CLASS 
                NAME '1038299 to 2076594'
                EXPRESSION ([value]<=2076594)
                COLOR 254 204 92
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
                LABEL
                    FONT arial
                    TYPE truetype
                    ANTIALIAS false
                    SIZE 8
                    COLOR 0 0 0
                    POSITION AUTO
                    PARTIALS FALSE
                    FORCE true
                    OFFSET 0 5
                    #OUTLINECOLOR 150 150 150
                END
            END  # CLASS
            CLASS 
                NAME '2076594 to 3114890'
                EXPRESSION ([value]<=3114890)
                COLOR 253 141 60
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
                LABEL
                    FONT arial
                    TYPE truetype
                    ANTIALIAS false
                    SIZE 8
                    COLOR 0 0 0
                    POSITION AUTO
                    PARTIALS FALSE
                    FORCE true
                    OFFSET 0 5
                    #OUTLINECOLOR 150 150 150
                END
            END  # CLASS
            CLASS 
                NAME '3114890 to 4153185'
                EXPRESSION ([value]<=4153185)
                COLOR 240 59 32
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
                LABEL
                    FONT arial
                    TYPE truetype
                    ANTIALIAS false
                    SIZE 8
                    COLOR 0 0 0
                    POSITION AUTO
                    PARTIALS FALSE
                    FORCE true
                    OFFSET 0 5
                    #OUTLINECOLOR 150 150 150
                END
            END  # CLASS
            CLASS 
                NAME '4153185 to '
                EXPRESSION ([value]>4153185)
                COLOR 189 0 38
                OUTLINECOLOR 150 150 150
                TEMPLATE 'dummy'
                LABEL
                    FONT arial
                    TYPE truetype
                    ANTIALIAS false
                    SIZE 8
                    COLOR 0 0 0
                    POSITION AUTO
                    PARTIALS FALSE
                    FORCE true
                    OFFSET 0 5
                    #OUTLINECOLOR 150 150 150
                END
            END  # CLASS    
        END  # LAYER
        
END


More information about the mapserver-users mailing list