[Mapserver-users] WMS client re-projection errors

Arnulf Christl arnulf.christl at ccgis.de
Wed Jul 14 04:01:30 EDT 2004


Matthew Perry wrote:

>Paul,
>
>  Even if I pretend the WMS & the map are nad83
>(epsg:4269right?) the image is still mis-aligned. In
>fact, the only way to get a proper image is to set the
>map to
>4326.
>
>I have noticed that the USGS WMS is slightly evil in
>that if you fudge the extents on a GetMap request, the
>image will be warped instead of recalculating a
>proportional bounding box. 
>
>What is does the WMS standard say about this?? What
>behavior is mapserver expecting?? 
>
>  
>
Hi,
the WMS standard specifies that WMS Server Software has to return 
exactly the requested coordinate bounding box, if requested also with 
non-square pixels (you want 400 by 400 meter map but with a res of 200 
by 400 pixel, then the y-etxtent gets "squashed" by 0.5). At first this 
sounds pretty awkward but it makes a lot of sense as the client does not 
get any information from the WMS as to how it has recalculated the 
proportional bounding box, it only receives an image and has to take 
care of the bbox all by itself. Not squashing images would lead to 
incorrect bbox coords in the client and result in further navigation 
going amiss.
All conforming (!!! not "implementing" !!!) WMS are capable of returning 
so to say "non-square pixel" images.

We have discussed this topic on this list several times, consensus 
beeing that we will need it. I believe that in one of the next versions 
UMN MapServer will also be able to return non-square pixels (any newer 
information?).

Regards, Arnulf.

>- matt
>
>--- Paul Ramsey <pramsey at refractions.net> wrote:
>  
>
>>Oh, interesting... yeah, you would get better shifts
>>in 83<->27 because 
>>the grid shift files are there, whereas for WGS84 it
>>would have to do a 
>>much simpler mathematical transform. Try pretending
>>that your WGS84 data 
>>is actually NAD83 (the spheroids are practically
>>identical) and see if 
>>things get better.
>>
>>    
>>
>
>--- Paul Ramsey <pramsey at refractions.net> wrote:
>  
>
>>My guess is that the act of stuffing the WMS through
>>a datum transform 
>>is messing things up... what happens if you set your
>>output to 26910, 
>>and set the projection object in your WMS layer to
>>be 4269 (NAD 83 
>>lat/lon) instead of 4236? (ie, pretend your image is
>>in NAD83, so that 
>>mapserver does not attempt to datum shift it.
>>
>>If things still fail, then it is time to turn up the
>>logging and see 
>>what the WMS requests to USGS are. Your suspicion
>>that Mapserver might 
>>be asking for incorrect bounding boxes from USGS
>>when doing transforms 
>>might be correct.
>>
>>Paul
>>
>>Matthew Perry wrote:
>>
>>    
>>
>>>Paul,
>>> Thanks for the response. I tried some of your
>>>suggestions....
>>>
>>>
>>>      
>>>
>>>>Change your output projection to 26910, so that
>>>>        
>>>>
>>your
>>    
>>
>>>>vectors are being 
>>>>datum shifted but your image is not. 
>>>>        
>>>>
>>>This still requires the WMS image to be
>>>      
>>>
>>transformed
>>    
>>
>>>from wgs84 to nad83. Predictably, the image is
>>>      
>>>
>>still
>>    
>>
>>>mis-aligned.
>>>
>>>
>>>      
>>>
>>>>If things are still not working, try setting your
>>>>output projection to 
>>>>4326, so your vectors are being tranformed into
>>>>        
>>>>
>>the
>>    
>>
>>>>native projection of 
>>>>your raster. 
>>>>        
>>>>
>>>Eureka! The layers are aligned regardless of their
>>>position on the image...
>>>
>>>
>>>      
>>>
>http://darkstar.rr.nu/cgi-bin/mapserv?mode=map&map=/var/www/htdocs/klamath2/klamath2.map&mapext=-121.848094294579+42.7195258065662+-121.742700618268+42.7713535046386&mapsize=610+420&layers=Roads+Shaded_relief
>  
>
>>>Unfortunately, for a number of reasons, I need to
>>>      
>>>
>>keep
>>    
>>
>>>the map in the native projection of my vector
>>>      
>>>
>>layers.
>>    
>>
>>>Based on my wild guess, It seems as if mapserver
>>>      
>>>
>>is
>>    
>>
>>>not requesting the correct bounding box from the
>>>      
>>>
>>WMS
>>    
>>
>>>when the datum shift (wgs84->nad27/nad83) is
>>>      
>>>
>>involved.
>>    
>>
>>>Would this be a correct assumption? 
>>>
>>>Matthew Perry
>>>Humboldt State
>>>
>>>
>>>-----------------------------
>>>
>>>      
>>>
>>>>Matthew Perry wrote:
>>>>
>>>>
>>>>        
>>>>
>>>>>Hi folks,
>>>>> 
>>>>> I have some shapefiles in UTM, NAD27, Zone 10
>>>>>(epsg:26710) which I'm trying to overlay on a WMS
>>>>>shaded relief layer from the USGS in Geographic,
>>>>>          
>>>>>
>>>>WGS84
>>>>
>>>>        
>>>>
>>>>>(epsg:4326). The problem is a noticable
>>>>>          
>>>>>
>>distortion
>>    
>>
>>>>on
>>>>
>>>>        
>>>>
>>>>>the y axis. Features line up at the center of the
>>>>>image, but become more and more distorted as you
>>>>>          
>>>>>
>>>>move
>>>>
>>>>        
>>>>
>>>>>above or below the center-line. 
>>>>>
>>>>>These three images should capture the idea (keep
>>>>>          
>>>>>
>>>>your
>>>>
>>>>        
>>>>
>>>>>eye on the peak in relation to the roads around
>>>>>          
>>>>>
>>>>it):
>>>>
>>>>        
>>>>
>>>>>http://darkstar.rr.nu/download/mapserv1.jpg
>>>>>http://darkstar.rr.nu/download/mapserv2.jpg
>>>>>http://darkstar.rr.nu/download/mapserv3.jpg
>>>>>
>>>>>
>>>>>It is almost as though the WMS image is
>>>>>          
>>>>>
>>vertically
>>    
>>
>>>>>compressed. However, when using a WMS image from
>>>>>terraserver (nad83), the map is aligned properly.
>>>>>          
>>>>>
>>>>I am
>>>>
>>>>        
>>>>
>>>>>running mapserver 4.2.0 on slackware linux with
>>>>>          
>>>>>
>>>>proj
>>>>
>>>>        
>>>>
>>>>>4.4.7 & the datum shift files. Perhaps the
>>>>>          
>>>>>
>>>>requested
>>>>
>>>>        
>>>>
>>>>>WMS extents are not accurate because of the datum
>>>>>shift?? Is there something unique to shifting
>>>>>          
>>>>>
>>from
>>    
>>
>>>>>wgs84 to nad27?? Anyone have any ideas?
>>>>>
>>>>>
>>>>>The abbreviated mapfile is as follows:
>>>>>-----------------------------
>>>>>MAP
>>>>>
>>>>> PROJECTION
>>>>>   "init=epsg:26710"
>>>>>   # UTM zone 10, Nad27, meters
>>>>> END
>>>>>
>>>>> LAYER
>>>>>   NAME "Shaded_relief"
>>>>>   GROUP "bg"
>>>>>   STATUS OFF
>>>>>   TYPE RASTER
>>>>>   CONNECTIONTYPE WMS
>>>>>   CONNECTION
>>>>>
>>>>>          
>>>>>
>"http://gisdata.usgs.net:80/servlet/com.esri.wms.Esrimap?servicename=USGS_WMS_NED&"
>  
>
>>>>>   METADATA
>>>>>     "wms_srs"    "EPSG:4326"
>>>>>     "wms_title"    "Shaded Relief"
>>>>>     "wms_name"    "US_NED_Shaded_Relief"
>>>>>     "wms_server_version"    "1.0.0"
>>>>>     "wms_format"    "image/png"
>>>>>     "wms_group_title" "background"
>>>>>   END
>>>>>   PROJECTION
>>>>>     "init=epsg:4326"
>>>>>   END
>>>>> END
>>>>>
>>>>> LAYER
>>>>>   NAME "Roads"
>>>>>   STATUS OFF
>>>>>   DATA "clip1"
>>>>>   TYPE LINE
>>>>>   TOLERANCE 2
>>>>>   DUMP true
>>>>>   METADATA
>>>>>     "wms_title"    "Klamath Basin Roads"
>>>>>     "wms_srs"    "EPSG:26710"
>>>>>     "wms_abstract" ""
>>>>>     "wfs_title"   "Klamath Basin Roads"
>>>>>     "wfs_srs"    "EPSG:26710"
>>>>>     "wfs_abstract" ""
>>>>>   END
>>>>>   CLASS
>>>>>     NAME "Roads"
>>>>>     STYLE
>>>>>       SYMBOL 1
>>>>>       SIZE 2
>>>>>       COLOR 0 0 0
>>>>>     END
>>>>>   END
>>>>> END
>>>>>
>>>>>END
>>>>>---------------------------------
>>>>>
>>>>>
>>>>>Here is a link to a small, clipped shapefile if
>>>>>          
>>>>>
>>>>anyone
>>>>
>>>>        
>>>>
>>>>>feels inclined to try it out...
>>>>>
>>>>>http://darkstar.rr.nu/download/clip1.zip
>>>>>
>>>>>          
>>>>>
>=== message truncated ===
>
>_______________________________________________
>Mapserver-users mailing list
>Mapserver-users at lists.gis.umn.edu
>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
>  
>


-- 
----------------------------
CCGIS Christl & Stamm GbR
----------------------------
http://www.ccgis.de
http://www.mapbender.org
----------------------------
Service: +49 (0)228 90826 0
Direct:  +49 (0)228 90826 23
Fax:     +49 (0)228 90826 11
----------------------------
CCGIS Christl & Stamm GbR
Siemensstraße 8
53121 Bonn
GERMANY





More information about the mapserver-users mailing list