[mapserver-users] mapserver wms: srs problem

Matthew Pettis matthew.pettis at gmail.com
Wed Jun 11 19:30:54 EDT 2008


Hi All,

I'm posting further findings and observations.  I made a simple
mapfile and dumped the shape information to a .shp file.  I have made
a .zip file with all of the components to verify what I will be
saying, and will provided it upon request to individuals (don't want
to pollute inboxes on the listserv indiscriminantly).

First, I have discovered that when I render the shapefile NOT as a
WMS, but just with a url like:

http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\tb\ex.map&mode=map

the coords are unprojected, and I get the expected (tall and skinny)
map of MN.  When I call mapserver as a WMS (with epsg:26915), like:

http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\tb\ex.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&LAYERS=state&BBOX=184056.505,4809728.25,767381.245,5478975.75&SRS=EPSG:26915&format=image/png&width=800&height=600

then I get a map, but the map stretches to the dimensions I set the
image 'height' and 'width' parameters to.  This does not happen with
the non-WMS request.

So the point is, my WMS map calls stretch as a function of the image
width and height (which is how it is called for openlayers).  If I
want the unprojected map via WMS (that doesn't stretch based on the
tile image dimensions), how do I configure my WMS url, or .map file
(particularly for openlayers)?

Thanks again for everybody's help,
Matt

On Tue, Jun 10, 2008 at 11:26 AM, Barend Kobben <kobben at itc.nl> wrote:
> Hi,
>
> It looks like your mixing up several things that shouldn't be mixed:
>
> 1)
> http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\ol\wms.map&SE
> RVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
> ...is a valid WMS GetCapabilities request. It might result in a valid WMS
> response (although I cannot test this as I obviously  do not have the same
> localhost as you...)
>
> However:
> http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\ol\wms.map&mo
> de=map
> ...is a non-WMS request, it uses the 'old' MapServer CGI mode, not the OGC
> standardised WMS interface. To get a map the "WMS way" you'd request
> something like:
> http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\ol\wms.map&m&
> SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&LAYERS=aLayer&BBOX=1,2,3,4&
> SRS=EPSG:4326&format=image/gif
>
> 2) next, you advertise your data to be in lat-lon on the WGS 84 (PROJECTION
> init=epsg:4326), but you proclaim the EXTENT of the data to be in meters or
> some other projected unit:
> EXTENT      184056.505 4809728.25 767381.245 5478975.75
> This obviously are not lat-lon degrees (which have a max extent of
> -180,180,-90,90)... Now MS will be really confused! "Hmmmm, this client
> wants lat-lon data that stretches over the whole of the universe..." :-)
>
> 3) you then advertise the WMS to be able to deliver data in a non-projected
> and a projected SRS:
>  "wms_srs"             "EPSG:4326 EPSG:26915"
> Which is fine, but you do it again for the LAYER, which I think is
> superfluous.
>
> 4) You do NOT tell the WMS what SRS the data originally is in. There is no
> PROJECTION object in the LAYER, which in some case might lead to MapServer
> trying to find out for itself, BUT NOT in the Postgis case you have. A
> connection to PostGIS in itself needs to be told which projection to fetch
> the data in (because PosGIS can reproject if necessary). One of the ways of
> doing that is to make the DATA statement a bit more elaborate than
>  "the_geom from shp_state", instead use
>  DATA   "the_geom from shp_state using unique <your_primary_key> using
> srid=26915"
>
> Hope this helps...
>
> --
> Barend Köbben
> International Institute for Geo-Information
> Sciences and Earth Observation (ITC)
> PO Box 6
> 7500AA Enschede, The Netherlands
> +31 (0)53 4874253
>
> International Institute for Geo-Information Science and Earth Observation (ITC)
> Chamber of Commerce: 410 27 560
>
> E-mail disclaimer
> The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission.
>



-- 
It is from the wellspring of our despair and the places that we are
broken that we come to repair the world.
-- Murray Waas


More information about the mapserver-users mailing list