Projection with Mapserver & PRJ

Frank Warmerdam warmerdam at POBOX.COM
Tue Jan 24 16:07:13 EST 2006


On 1/24/06, Brian Peschel <brianp at occinc.com> wrote:
> Does MapServer use PRJ files?  I need to do some projections with shape
> files.  All of my shape files sets have prj files (ie town.shp, town.shx,
> town.dbf, town.prj).  If I setup a map level projection like:
>   PROJECTION
>     "init=epsg:4326"
>   END
>
> do I need to setup a layer level projection also?  Or will MapServer read
> the PRJ files and do the conversion on the fly for me?  I am struggling to
> understand how to convert a PRJ file into the PROJ.4 parameters like:
>   PROJECTION
>       "proj=laea"
>       "ellps=clrk66"
>       "lat_0=45"
>       "lon_0=-100"
>   END
> (which is from the tutorial, and is not the settings I need).

Brian,

Generally speaking MapServer ignores coordinate system
definitions that come with the data, and requires you to
redeclare the coordinate system in the .map file if reprojection
might be required.   There is some residual support for "AUTO"
projections which is intended to read it from the file, but that
hasn't been tested or used much and is likely broken currently.

If you get desperate you can post your .prj file contents and
folks might be able to let you know the corresponding PROJ.4
string.   It is also possible to do this automatically with
GDAL/OGR, but the mechanism is a bit involved, so I won't
go into it here.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list