Changes between Version 3 and Version 4 of RasterVrtDerivedBands
- Timestamp:
- Feb 16, 2012, 11:37:24 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RasterVrtDerivedBands
v3 v4 1 1 = Using GDAL VRT images with derived bands in MapServer = 2 2 3 The GDAL virtual image format (VRT) allows the creation of derived bands that derive their pixel information from their source bands. A general overview is given at the [http://www.gdal.org/gdal_vrttut.html GDAL web site]. This how-to describes the steps to make this type of raster format usable in !MapServer, based on the sample code of the GDAL site. The emphasis lies on the creation and registration of the required pixel function used for the derived band.3 The GDAL virtual image format (VRT) allows the creation of bands that derive their pixel information from their source bands (using raster algebra). A general overview is given at the [http://www.gdal.org/gdal_vrttut.html GDAL web site]. This how-to describes the steps to make this type of raster format work from the !MapServer environment. The code samples are based on the code from the GDAL site. The emphasis lies on the creation and registration of the required pixel function used for the derived band(s). 4 4 5 5 == Definition of the VRT image == … … 8 8 <VRTDataset rasterXSize="1000" rasterYSize="1000"> 9 9 <VRTRasterBand dataType="Float32" band="1" subClass="VRTDerivedRasterBand"> 10 <Description>Magnitude</Description> 11 <PixelFunctionType>TestFunction</PixelFunctionType> 12 <SourceTransferType>CFloat64</SourceTransferType> 10 11 <PixelFunctionType>TestFunction</PixelFunctionType> 13 12 ... 14 13 }}} 15 14 16 The important part is the refer nce of the pixel function, here name {{{TestFunction}}}15 The important part is the reference of the pixel function, here named {{{TestFunction}}}. 17 16 18 17 == Creation of the pixel function == … … 58 57 } 59 58 59 /* Register the function */ 60 60 void GDALRegister_TestFunction() { 61 61 GDALAddDerivedBandPixelFunc("TestFunction", TestFunction); 62 62 } 63 63 64 }}} 65 64 66 65 67 Compile the function … … 82 84 }}} 83 85 84 Restart the Apache server and the VRT images with the pixel functions should be read without problems from !MapServer. At least for simple raster algebra I have not noticed performance degradation due to the derived bands. 86 More information for {{{GDAL_DRIVER_PATH}}} [http://trac.osgeo.org/gdal/wiki/ConfigOptions#GDAL_DRIVER_PATH see here]. 85 87 86 Important to note that the pixel function works also for the image ''overviews'' (at least using the standard internal and external .ovr files, ERDAS .aux types have not been tested with this). 88 Restart the Apache server and the VRT images with the pixel functions should be read without problems from !MapServer. At least for simple raster algebra I have not experienced noticeable performance degradation due to the derived bands. 89 90 Important to note that the pixel function works also for the image ''overviews'' (at least using the standard internal overviews or external .ovr files, ERDAS .aux types have not been tested with this). 87 91 88 92 == Use of VRT derived bands with PHP !MapScript == … … 95 99 (one of them might not be necessary...) 96 100 97 Restart Apache and everything should work. 101 Restart Apache and everything should work. 102 103 For other !MapScript versions this additional setting of the GDAL environment variable might be necessary as well. 98 104 99 105