[Mapserver-users] Can't seem to get the projection correct

Hankley, Chip Chip.Hankley at GASAI.Com
Tue Feb 18 10:05:19 PST 2003


Daniel,

I'm not sure what's going on w/ MapInfo... all I can tell you is that the
image your seeing is what North America looks like unprojected... the image
that you supplied from MapInfo is *definitely* projected in some way.

This however, is somewhat beside the point. Presumably you don't want your
data to look squished. To accomplish this, you need to apply a projection to
your mapfile.

To do this, you need to specify the projection in two places. See the
following docs for help:

http://mapserver.gis.umn.edu/doc36/coordinates.html

http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?WindowProjHowTo (for windows
help w/ proj4)

Basically, for each LAYER that is based on Lat/Long data, you need to put
the following:

      PROJECTION
        geographic
      END

You mentioned that you thought MapServer would automatically detect the
projection of your data... I don't think that will happen. I'm almost
positive you'll need to define it for each layer (but I don't use OGR that
much...).

At the head of your mapfile, perhaps just, below your WEB section, you need
to define the projection for you mapfile. This can be anything you want to
define... what David provided earlier would work great:

PROJECTION # ALBERS OK 
	proj=aea
	lat_1=29.500000000 #SP1
	lat_2=45.500000000 #SP2
	lat_0=23.000000000 #REF LAT
	lon_0=-96.000000000 #CENTRAL MERIDIAN
	x_0=0.000 #FALSE EAST
	y_0=0.000 # FALSE NORTH
	datum=NAD83
	ellps=GRS80
	no_defs
END

You will also need to specify an EXTENT and UNITS that are consistent with
the mapfile projection:

EXTENT -2754551.645635 -50772.085462 2705180.652909 4539365.754241
UNITS METERS

For any of this to work, you must have PROJ4 set up correctly.

HTH!

Chip Hankley



More information about the MapServer-users mailing list