[mapserver-users] mapserver + grib files + explanation and questions

Muro muraro_davide at hotmail.com
Thu Jul 1 06:50:29 PDT 2010


Hello,

After some time I was able to process grib v.1 format using
MapServer+gdal+OL 2.9.

I see the requested band and I get the point-clicked-value using
OL-getfeatureinfo.

My mapfile:

LAYER
	NAME 'EUD201006_cp-lsp'
	DATA '/var/www/html/netcdf/mapserver/data/EUD201006_cp-lsp.grb'
	TYPE RASTER
	DUMP true
	TOLERANCE 10
	TOLERANCEUNITS DD
	
	HEADER "templates/getfeatureinfo_header.html" # header html template
	TEMPLATE "templates/getfeatureinfo_content.html" # content html template
	FOOTER "templates/getfeatureinfo_footer.html" # footer html template		
	
	METADATA			
		'ows_title' 'EUD201006_cp-lsp.grb'
		'wms_feature_info_mime_type' "text/html"
		"gml_include_items" "all"			
		"wms_include_items"   "all"			
	END

	STATUS OFF
			
	PROJECTION
		'proj=longlat'
		'ellps=WGS84'
		'datum=WGS84'
		'no_defs'
	END
  		
	#PROCESSING "DITHER=YES"
	#PROCESSING "BANDS=30,24,4"
	PROCESSING "BANDS=6136"
	#PROCESSING "BANDS=30,50,70,90,110"		 
	
	#0.070106506 =  70 mm
	
	CLASS
		NAME "0.00 to 0.07"
		EXPRESSION ([pixel] >= 0 AND [pixel] < 0.005)
		STYLE
		COLOR 205 250 100
		END
	END
	CLASS
		NAME "0.07 to 0.14"
		EXPRESSION ([pixel] >= 0.005 AND [pixel] < 0.01)
		STYLE
		COLOR 145 240 67
		END
	END
	CLASS
		NAME "0.14 to 0.20"
		EXPRESSION ([pixel] >= 0.015 AND [pixel] < 0.02)
		STYLE
		COLOR 88 230 32
		END
	END
	CLASS
		NAME "0.20 to 0.27"
		EXPRESSION ([pixel] >= 0.02 AND [pixel] < 0.025)
		STYLE
		COLOR 62 209 54
		END
	END
	CLASS
		NAME "0.27 to 0.34"
		EXPRESSION ([pixel] >= 0.025 AND [pixel] < 0.03)
		STYLE
		COLOR 61 186 101
		END
	END
	CLASS
		NAME "0.34 to 0.41"
		EXPRESSION ([pixel] >= 0.03 AND [pixel] < 0.035)
		STYLE
		COLOR 49 163 144
		END
	END
	CLASS
		NAME "0.41 to 0.48"
		EXPRESSION ([pixel] >= 0.035 AND [pixel] < 0.04)
		STYLE
		COLOR 30 134 166
		END
	END
	CLASS
		NAME "0.48 to 0.54"
		EXPRESSION ([pixel] >= 0.04 AND [pixel] < 0.045)
		STYLE
		COLOR 33 88 150
		END
	END
	CLASS
		NAME "0.54 to 0.61"
		EXPRESSION ([pixel] >= 0.045 AND [pixel] < 0.05)
		STYLE
		COLOR 28 52 135
		END
	END
	CLASS
		NAME "0.61 to 0.68"
		EXPRESSION ([pixel] >= 0.05 AND [pixel] < 0.055)
		STYLE
		COLOR 13 17 120
		END
	END

	CLASS
		NAME "0.61 to 0.68"
		EXPRESSION ([pixel] >= 0.055)
		STYLE
		COLOR 255 0 255
		END
	END
	
END


OpenLayers code:

var wmsOptions = {
	layers: 'EUD201006_cp-lsp',				
	//layers: 'EUD2010060100, vol_soil_water',				
	format: 'image/png',
	maxExtent: maxExtentDD,
	transparent: 'true'
};		    
gribLayer = new OpenLayers.Layer.WMS( 'wms grib layer', geoserver ,
wmsOptions, {isBaseLayer:true, buffer:0, displayInLayerSwitcher:true });			            
map.addLayer(gribLayer);

map.addControl( new OpenLayers.Control.LayerSwitcher() );
	
map.events.register('click', map, function (e) 
{
    OpenLayers.Util.getElement('nodeList').innerHTML = "Loading... please
wait...";	            
    var url =  gribLayer.getFullRequestString({
                    REQUEST: "GetFeatureInfo",
                    EXCEPTIONS: "application/vnd.ogc.se_xml",
                    BBOX: gribLayer.map.getExtent().toBBOX(),
                    X: e.xy.x,
                    Y: e.xy.y,
                    INFO_FORMAT: 'text/html',
                    QUERY_LAYERS: gribLayer.params.LAYERS,	                            
                    WIDTH: gribLayer.map.size.w,
                    HEIGHT: gribLayer.map.size.h});
    OpenLayers.loadURL(url, '', this, setHTML);
    OpenLayers.Event.stop(e);
});  

Is possible to do a getfeatureinfo for all bands?
If I use PROCESSING "BANDS=30,24,4", I get 3 values (correctly)
Reading the documentation (http://mapserver.org/input/raster.html#raster) is
possible to query more than RGB-opaque (4 bands)

[CUT]
The red, green and blue attribute are intended to be the final color the
pixel would be rendered with, but in some subtle cases it can be wrong (ie.
classified floating point results). The selected bands are normally the band
that would be used to render the layer. For a pure query-only layer BANDS
PROCESSING directive can be used to select more bands than could normally be
used in a render operation. For instance for a 7 band landsat scene a
PROCESSING “BANDS=1,2,3,4,5,6,7” directive could be used to get query
results for all seven bands in results to a query operation.
[/CUT]

I mean, when I click on a point I need to get all values associated to that
point. 
There are 6136 bands in my grib file.
I removed PROCESSING "BANDS=6136", but mapserver crashes (500 internal
error...mm no good)
I added PROCESSING "BANDS=10,20,30,40,50", but mapserver crashes (500
internal error)

Ideas? Is it possible?


-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/mapserver-grib-files-explanation-and-questions-tp5243456p5243456.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list