[GIS] Error with MapServer WMS GetMap request, how to fix it

getmapmapserverwms

I got this message when I call GetMap on a MapServer WMS

msWMSLoadGetMapParams(): WMS server error. Missing required parameter SRS

What causes that problem?

Best Answer

The cause of the problem is that the service is expecting a SRS parameter and you have not supplied one.

If you are making a GetMap (and GetFeatureInfo) request with WMS versions 1.1.1 or below, you must pass the coordinate reference system to the WMS Server (in this case MapServer, but the same is true for all WMS servers) using the SRS parameter.

Like SRS=epsg:27700& in the below GetMap request:

http://.../cgi-bin/BGS_Bedrock_and_Superficial_Geology/wms? 
  service=WMS&
  version=1.1.1&
  request=GetMap&
  layers=GBR_BGS_625k_BA&
  format=image/png&
  SRS=epsg:27700&
  bbox=0,0,700000,1300000&
  width=350&
  height=650&
  styles&

For WMS version 1.3.0 the parameter name changes to CRS (spelling of parameter names is not case sensitive, just using capitals for emphasis here).

Like CRS=EPSG:4326& in the below GetMap request:

http://.../cgi-bin/BGS_GSI_Geology/wms?
 REQUEST=GetMap&
 SERVICE=WMS&
 VERSION=1.3.0&
 LAYERS=IND_GSI_2M_Thrusts&
 STYLES=default&
 FORMAT=image/png&
 BGCOLOR=0xFFFFFF&
 TRANSPARENT=TRUE&
 CRS=EPSG:4326&
 BBOX=6.0,67.0,36.0,97.0&
 WIDTH=650&
 HEIGHT=650&
Related Question