Hi,

Ok, I start to understand little by little. It is not about making your 
Mapserver to support several SRS in output, it is about making your Mapserver 
to send GetMaps to cascaded remote WMS services by using the most reasonable 
SRS in the request, that is, usually the same SRS as used for output so that 
Mapserver does not need to do interim warping.

I suggest to include enough from the mapfile for making the questions and 
answers understandable. Let's take this sample from 
http://mapserver.org/ogc/wms_client.html

LAYER
  NAME "country_bounds"
  TYPE RASTER
  STATUS ON
  CONNECTION "http://demo.mapserver.org/cgi-bin/wms?";
  CONNECTIONTYPE WMS
  METADATA
    "wms_srs"             "EPSG:4326"     #<=== THIS CAN BE A SPACE SEPARATED 
LIST
    "wms_name"            "country_bounds"
    "wms_server_version"  "1.1.1"
    "wms_format"          "image/gif"
  END
END

You would like to use variable substitution in "wms_srs" "EPSG:%srs%". That is 
not possible because there are only a few places where substitutions can be 
used. See http://mapserver.org/cgi/runsub.html and Parameters supported.
However, if you want to support output in 'EPSG:32633 EPSG:3006 EPSG:900913 
EPSG:4326' you can use the same list in the "wms_srs" metadata item of the 
cascaded WMS layer. Then if you want output in EPSG:32633 Mapserver will use 
the same SRS in GetMaps that it is creating and I suppose that it is your goal.

Be aware with EPSG:900913, recent Mapservers do not support it out-of-the-box 
but you must edit the epsg projection file manually. It would better to use  
EPSG:3857 instead but then the remote WMS should also understand the meaning of 
EPSG:3857 .

If request rewriting is absolutely needed, like you want to send out EPSG:3857 
but remote WMS understands only EPSG:900913 or you need to do some other 
tailored mapping between the codes, then I suppose you should  use some 
miraculous mapscript for rewriting the mapfile.
-Jukka Rahkonen-




Schylberg Lars wrote:

Mike,

Thanks for your reply, but it is when I call the wms services as a client I get 
the errors already in the validation.  I would like to do something like this:
But I guess I am doing something that is not meant to be this way.

MAP
  NAME MAP_MAIN
  SIZE 1000 1000
  CONFIG "PROJ_LIB" './'
  UNITS dd
  EXTENT 9.624750 52.33333 30.333333 66.500000

 PROJECTION
     'init=epsg:4326'
  END

  IMAGETYPE png
  FONTSET './fonts/fontset.lst'
  SYMBOLSET "./symbols/symbols.sym"
  OUTPUTFORMAT
    NAME 'AGG'
    DRIVER AGG/PNG
    IMAGEMODE RGB
  END

  SHAPEPATH ../data/shape


  WEB
    IMAGEPATH '/tmp/'
    IMAGEURL '/tmp/'

    METADATA
      "ows_enable_request"   "*"
      'wms_title'           'MAP_MAIN'
      'wms_srs'  'EPSG:32633 EPSG:3006 EPSG:900913 EPSG:4326'
      "labelcache_map_edge_buffer" "-10"
    END
  END

    VALIDATION
       "srs" "^[0-9]{4,5)$"
    END

###############  Layer 0 as WMS request

   LAYER
     NAME "WMS-layer-0"
     OFFSITE 200 0 0
     TYPE RASTER
     CONNECTIONTYPE WMS
     CONNECTION "http://localhost/cgi-bin/mapserv?map=/var/www/html/map0.map";
     METADATA
       "wms_srs"               'EPSG:''%srs%'
       "wms_name"              "map0"
       "wms_server_version"    "1.1.1"
       "wms_format"            "image/png"
       "wms_exceptions_format" "application/vnd.ogc.se_inimage"
     END
   END #layer

###############  Layer 1 as WMS request

   LAYER
     NAME "WMS-layer-1"
     OFFSITE 200 0 0
     TYPE RASTER
     CONNECTIONTYPE WMS
     CONNECTION "http://localhost/cgi-bin/mapserv?map=/var/www/html/map1.map";
     METADATA
       "wms_srs"               'EPSG:''%srs%'
       "wms_name"              "map1"
       "wms_server_version"    "1.1.1"
       "wms_format"            "image/png"
       "wms_exceptions_format" "application/vnd.ogc.se_inimage"
     END
   END #layer

END # Map

From: Smith, Michael ERDC-RDE-CRREL-NH [mailto:michael.sm...@erdc.dren.mil]
Sent: den 6 februari 2015 16:31
To: Schylberg Lars; 
mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
Subject: Re: [EXTERNAL] [mapserver-users] WMS SRS as variable

Lars,

A WMS map can support multiple SRS's. Just list all the ones you want in the 
METADATA block. Look at http://mapserver.org/ogc/wms_server.html and 
specifically the Map PROJECTION and wms_srs metadata. From the example, you can 
see that 2 SRS's are supported.


 METADATA

    "wms_title"           "WMS Demo Server"

    "wms_onlineresource"  "http://my.host.com/cgi-bin/mapserv?map=wms.map&";

    "wms_srs"             "EPSG:4269 EPSG:4326"

  END
Just keep adding to the list to support more projections.

Mike


From: Schylberg Lars 
<lars.schylb...@saabgroup.com<mailto:lars.schylb...@saabgroup.com>>
Date: Friday, February 6, 2015 at 10:05 AM
To: "mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>" 
<mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>>
Subject: [EXTERNAL] [mapserver-users] WMS SRS as variable
Resent-From: Michael Smith 
<michael.sm...@usace.army.mil<mailto:michael.sm...@usace.army.mil>>

Hello,

I wonder if there is a way to set SRS as a variable in a map file.

I have one map file that uses several other WMS clients that also are mapfiles.
I would like to use the SRS as variable to make the WMS service more flexible.

I have tried to do VALIDATION on SRS variable, but that only gives errors.

Thanks /Lars S.

_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to