Home | Products | Issue Tracker | FAQ | Download | |
There are thousands of geographical reference systems. In order to combine datasets with different geographical reference systems into a map, the datasets will have to be transformed (projected) to the chosen geographical reference system of the map. If you want to know more about geographical reference systems and map projections in general, please see the More Information links below, or look into Geomatics courses (Geographical Information Systems, Cartography, Geodesy), as projections are an advanced topic for beginners.
To set up projections you must define one projection object for the output image (in the MAP object) and one projection object for each layer (in the LAYER objects) to be projected. MapServer relies on the Proj.4 library for projections. Projection objects therefore consist of a series of PROJ.4 keywords, which are either specified within the object directly or referred to in an EPSG file. An EPSG file is a lookup file containing projection parameters, and is part of the PROJ.4 library.
The following two examples both define the same projection (UTM zone 15, NAD83), but use 2 different methods:
Example 1: Inline Projection Parameters
PROJECTION
"proj=utm"
"ellps=GRS80"
"datum=NAD83"
"zone=15"
"units=m"
"north"
"no_defs"
END
注解
For a list of all of the possible PROJ.4 projection parameters, see the PROJ.4 parameters page.
Example 2: EPSG Projection Use
PROJECTION
"init=epsg:26915"
END
注解
This refers to an EPSG lookup file that contains a ‘26915’ code with the full projection parameters. “epsg” in this instance is case-sensitive because it is referring to a file name. If your file system is case-sensitive, this must be lower case, or MapServer (Proj.4 actually) will complain about not being able to find this file.
注解
See http://spatialreference.org/ref/epsg/26915/ for more information on this coordinate system.
The next two examples both display how to possibly define unprojected lat/long (“geographic”):
Example 3: Inline Projection Parameters
PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END
Example 4: epsg Projection Use
PROJECTION
"init=epsg:4326"
END
The EPSG code for the commonly used “Web” or “Google” mercator projection is ‘3857’. See http://spatialreference.org/ref/sr-org/7483/ for more information on this coordinate system. This code was also unofficially referred to as EPSG:900913; you are recommended to use the official EPSG:3857 code instead, such as:
PROJECTION
"init=epsg:3857"
END
The following syntax may be used in LAYERs that are OGR connections, shapefile layers or raster layers :
PROJECTION
AUTO
END
注解
For other layer types, this syntax is invalid.