EPSG:CODE

How to Set a Projection in MapServer

MapServer defines coordinate reference systems using PROJ.4 parameters inside a PROJECTION block in the mapfile.

Method 1: Using an EPSG Code

The simplest approach is to reference the EPSG code directly:

Mapfile
MAP
  PROJECTION
    "init=epsg:5255"
  END

  WEB
    METADATA
      "wms_srs" "EPSG:5255"
    END
  END

  LAYER
    PROJECTION
      "init=epsg:5255"
    END
    ...
  END
END

Method 2: Using PROJ.4 Parameters

If the EPSG code is not recognized, specify the PROJ.4 parameters explicitly:

Mapfile
PROJECTION
  "+proj=tmerc"
  "+lat_0=0"
  "+lon_0=33"
  "+k=1"
  "+x_0=500000"
  "+y_0=0"
  "+ellps=GRS80"
  "+towgs84=0,0,0,0,0,0,0"
  "+units=m"
  "+no_defs"
END

Search for any EPSG code on the home page and copy the definition from the MapServer tab.

MAP vs LAYER Projections

WMS Projections

When serving WMS, declare supported projections in the metadata:

Mapfile
WEB
  METADATA
    "wms_srs" "EPSG:4326 EPSG:3857 EPSG:5255"
  END
END

Notes