[Mapserver-users] Ccoordinate/projection display problem?

Frank Warmerdam warmerdam at pobox.com
Fri Sep 12 14:02:02 EDT 2003


>     PROJECTION["Lambert_Azimuthal_Equal_Area"],
...
> Corner Coordinates:
> Upper Left  (-6086629.000, 4488761.000) (156d 3'31.10"E, 37d45'55.65"N)
> Lower Left  (-6086629.000,-2784239.000) (154d27'44.36"W,  3d 2'12.16"N)
> Upper Right ( 4279371.000, 4488761.000) (  4d 0'23.08"W, 53d59'22.66"N)
> Lower Right ( 4279371.000,-2784239.000) ( 61d 9'32.19"W, 11d18'12.56"N)
> Center      ( -903629.000,  852261.000) (113d12'19.80"W, 51d59'8.84"N)

Ann,

I haven't looked at all the details in your email, but I noticed the shapefile
went from roughly 180 degrees west to 180 degrees east, and the raster seems
to cover a large portion of the globe as well.  There are some pretty hairy
projections issues which can come into play when working on whole-earth views
and MapServer isn't really well suited to this, at least "in general".

All that said, you might get some reasonable approximation of functional
by setting your map coordinate system to the Lambert Azimuthal Equal Area
system used in the raster, and letting MapServer reproject the shapefile
for you.

However, the custom LAEA coordinate system is a bit tricky.  If you have
listgeo handy you might try running "listgeo -proj4 shdrlfi0201.tif" to
see what it things is a good "PROJ.4 string" representing the coordinate
system of the file in question.

I would guess you will want something like:

PROJECTION
   "+proj=laea +lat_0=45 +lon_0=-100 +datum=WGS84"
END

You can test convert points using the PROJ commandline tools something like
this:

warmerda at gdal2200[29]% cs2cs +proj=laea +lat_0=45 +lon_0=-100 +datum=WGS84 +to +proj=latlong +datum=WGS84
  -6086629. 4488761                                    (input)
  156d3'31.097"E        37d45'55.65"N 0.000            (output)

Projecting your lat/long vectors on the fly may prove impractical though.
I think that MapServer reprojects the rectangle of interest into the
source layers coordinate system and then uses that rectangle to spatially
query the shapes to draw.  For world projections or situations crossing
the dateline this may get all screwed up and not work well.  In these
cases, I would suggest pre-reprojecting your data into the same projection.

I believe you should be able to reproject your shapefile to laea using
a command something like this:

ogr2ogr -s_srs WGS84 -t_srs '+proj=laea +lat_0=45 +lon_0=-100 +datum=WGS84' statesp_laea statesp020.shp

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