[mapserver-users] automatically generate a layer's PROJECTION object for a mapfile?

Mark Phillips mbp at geomtech.com
Fri Jun 11 09:46:03 EDT 2010


Hi,

Does anyone know if there is a way to automatically generate the proj4
projection keyword values for a layer, needed for the PROJECTION object for
that layer in a mapfile. assuming that you have the layer's data in a file
that includes projection metadata?

I'm interested in using MapServer to create WMS services for a bunch of
raster layers, and I want to automatically generate the necessary mapfile(s)
with a script that scans a directory containing a bunch of raster files, and
creates the mapfile with a layer for each raster.   The rasters might be in
different projections (probably only a handful of different ones, but I
can't predict them in advance), and I'm at a loss as to how to automatically
generate the proj4 values for each layer's PROJECTION object.  The raster
files all have associated projection metadata with them --- I can use
gdalinfo to find out the projection's WKT string, but I haven't found a way
to convert that to the proj4 keyword values that are needed in the mapfile.

I know that I can manually load a raster layer into a desktop program such
as QGIS or uDig and use the program's GUI to find the projection's proj4
values.  But I need something that can be automated with a script that runs
with no GUI and no human interaction.

Alternatively, since I can find a layer's WKT projection string using
gdalinfo, it'd be really convenient if the mapfile PROJECTION object
accepted WKT strings, but the mapfile documentation says that the PROJECTION
object expects only proj4 keywords.  Is there a way to specify a projection
in a mapfile using WKT strings instead?  Or a way to use gdalinfo, or some
other command-line tool, to extract a file's projection as a proj4 string
instead of a WKT string?

I've searched the docs and mailing list for info on this but haven't come up
with anything; I'd appreciate any tips!

Thanks,

--Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100611/200f81be/attachment.html


More information about the mapserver-users mailing list