[Mapserver-users] WMS'ifying a MAP file and Reprojection OTF (shp, postgis & tiff)

Daniel Morissette morissette at dmsolutions.ca
Wed Jul 30 23:53:44 EDT 2003


Julia Harrell wrote:
> 
> All of the data (shapefile & PostGIS) is in EPSG:32019 (NC State Plane,
> units of Feet, 
> NAD 27 Datum). The viewer is only going to be requesting data from all
> participating 
> map servers in EPSG:4326 (Lat/Longs - WGS84 datum), so this is the only SRS
> we 
> care about the map service outputting map images in.
> 
> 
>>From my archive searching, I think I need to include a projection section
> for 
> each layer as well as in the main part of the MAP File. 


This is correct, since you want on the fly reprojection then you need 
PROJECTION definitions at both the map and layer level.


>  A) do I use the EPSG code in the MAP section for the 
>     SRS I want the maps output in? I want output in EPSG:4326,
>     so if this is the case, I assume my extents & units should be in
>     decimal degrees. 

The above would be correct, but you can set the top-level projection in 
either EPSG:4326 or EPSG:32019, it doesn't matter since the client will 
specify its own SRS and BBOX.

Don't forget to also set wms_srs metadata to "EPSG:32019 EPSG:4326" so 
that both projections are advertized in the WMS capabilities.

> Also, should we use the extents of the county
>     or use extents as far out as we want the Mapserver data to
>     be visible? Ideally we'd want to be able to view some of
>     the layers at a regional level (things like ETJs & City Limits).
> 

You can use the county extents since that's the extents of the data that 
you're serving.  Just as for the top-level projection the top-level 
EXTENTS don't matter much and are used only to advertize the server's 
overall extents in the capabilities.  The most important in order to get 
valid capabilities is that if you use 4326 then your EXTENTS and UNITS 
should be in decimal degrees.  If you use 32019 then the EXTENTS and 
UNITS should be in feet.


>  B) do I use the EPSG code in each LAYER section for the
>     SRS the data is actually stored in? I have data in EPSG:32019.
>     If I should be specifying the output SRS here too, then where
>     (and how) do I tell Mapserver what the actual SRS is? It doesn't 
>     read shapfile .prj files, so how will it know?
> 

Yes, your layers MUST include a PROJECTION block that corresponds to the 
projection of the data, in this case:

   PROJECTION
      "init=epsg:32019"
   END

BTW, note that you don't need the wms_srs metadata at the layer level 
since the layers inherit the top-level wms_srs settings for the WMS 
capabilities.

> 
>  C) What do we need to do to correctly handle the datum transformation?
>     I noticed the March 2003 discussion about PROJ support not 
>     necessarily meaning you have support for datum shifts.  Does this
>     handle only NAD27<->NAD83 datum shifts? I could certainly use
>     an example of how we should specify the datum transformation from 
>     NC State Plane (feet) NAD27 to WGS84 lat/longs for our output maps, 
>     if just specifying the EPSG SRS code is not enough.   
> 

Hummm... I could be completely wrong here, but assuming you have 
installed the PROJ nad shift files then specifying the EPSG codes should 
be enough.  Someone please correct me if I'm wrong.


>     Can someone please point me to a well-annotated example of what a MAP 
>     file should look like when reprojecting imagery with GDAL, instead of
> the 
>     (normally) built-in libtiff? Do we have to do anything differently, 
>     other than not have libtiff support enabled?  

There is nothing special to do except making sure that your build 
includes GDAL, that libtiff is not enabled and that you set a PROJECTION 
in the layer defn.  Here is an example coming from the Gmap WMS demo server:

LAYER
   NAME bathymetry
   METADATA
     "wms_title" "Elevation/Bathymetry"
   END
   TYPE RASTER
   STATUS ON
   DATA bath_mapserver.tif
   PROJECTION
     "init=epsg:42304"
   END
END


>     How do you tell if your build of Mapserver was compiled without libtiff?
>     Is it as simple as not seeing INPUT=TIFF on the -v command line output?

Yup, as simple as that.

Actually you had almost all the answers to your questions right!  ;)

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               morissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------




More information about the mapserver-users mailing list