Opened 19 years ago
Closed 19 years ago
#1118 closed defect (fixed)
WMS layers with connectiontype MS_WMS are overridden to MS_RASTER
Reported by: | hobu | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | WMS Server | Version: | 4.5 |
Severity: | normal | Keywords: | |
Cc: | bartvde@… |
Description
line 169 of maplayer.c sets the connectiontype to MS_RASTER if the layer's type is set to MS_LAYER_RASTER. This causes a problem for WMS layers that have their connectiontype set to MS_WMS already. if(layer->type == MS_LAYER_RASTER ) layer->connectiontype = MS_RASTER; I provoked this by trying to change the projection of a mapObj in mapscript from Albers to UTM zone 15 *after* the mapObj had been opened in mapscript. My WMS layer is defined as such: LAYER NAME ortho METADATA "wms_title" "USGS Digital Ortho-Quadrangles" "wms_srs" "EPSG:4326" "wms_connectiontimeout" "45" END STATUS ON TYPE RASTER CONNECTIONTYPE WMS CONNECTION "http://terraservice.net/ogcmap.ashx?VERSION=1.1.1&SERVICE=wms&LAYERS=DOQ&FORMAT=jpeg&styles=" PROJECTION "init=epsg:4326" END END In mapscript, I query for the object I want, calculate a UTM zone for it and set the wms_srs and projection objects of this layer to EPSG:26915 and init=epsg:26915, repectively. At first, I didn't attempt to monkey with the mapObj's projection. Later, I tried to also change the projection of the mapObj and provoked the error. My mapObj was initialized with this PROJECTION block: PROJECTION "proj=aea" "ellps=GRS80" "datum=NAD83" "lat_1=29.5" "lat_2=45.5" "lat_0=23.0" "lon_0=-96" "x_0=0" "y_0=0" END and I *also* set it with mapscript to be "init=epsg:26915", which then provokes the "Attempt to open a RASTER layer, but this is only supported after a raster query." error. This is because the WMS layer's layerinfo is NULL (a WMS layer does not have a layerinfo).
Change History (4)
comment:1 by , 19 years ago
Status: | new → assigned |
---|
comment:3 by , 19 years ago
Cc: | added |
---|
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It turns out that shp2img on pretty much any map with a WMS layer does produce this error, it is just supressed. MapScript is sensitive to "set errors" and reports it to the user where shp2img does not. Breaking in msSetError() in shp2img is helpful. MAP NAME "Testing" EXTENT -0.5 50.977222 0.5 51.977222 IMAGETYPE PNG IMAGECOLOR 255 255 255 STATUS ON SIZE 200 200 FONTSET "fonts.txt" SYMBOLSET "symbols.txt" WEB IMAGEPATH "/tmp" END LAYER NAME "WMS_RASTER" TYPE RASTER PROJECTION "init=epsg:4326" END #EXTENT -0.5 50.977222 0.5 51.977222 CONNECTIONTYPE WMS CONNECTION "http://wms.jpl.nasa.gov/wms.cgi?" METADATA wms_srs "EPSG:4326" wms_server_version "1.1.1" wms_name "global_mosaic" wms_style "visual" wms_format "image/jpeg" END STATUS DEFAULT END END My "fix" is to avoid calling msLayerGetExtent() for layers of type MS_LAYER_RASTER. For a regular raster layer, or a WMS layer, the whole layer API does not provide a constructive access to layer extents. I am a bit concerned that this will prevent use of raster tile indexes to get extents even though that might be a very effective way of collecting the extent. But for now I'm going to disregard that possibility. BTW, the getextents is being called from msGDALGetGeoTransform() which tries msOWSGetLayerExtent() as a way of checking for metadata extents if nothing else is available. I will apply the following change in 4.5 and 4.4.x. else if( lp->type != MS_LAYER_RASTER ) { return msLayerGetExtent(lp, ext); }
Note:
See TracTickets
for help on using tickets.