[Qgis-developer] Raster layer datasource

Frank Warmerdam warmerdam at pobox.com
Wed Feb 27 15:38:00 EST 2008


Peter Ersts wrote:
> Maurício de Paulo,
> 
> Currently there are no public methods in QgsRasterLayer class that 
> provide access to pixel level data; the class right now is really not 
> much more than a rendered. This is something that has been discussed but 
> will likely not be available in the immediate future. Your best approach 
> right now would be to open the image with GDAL yourself, process, write 
> our a new image, pass that to qgis to load; not idea but all possible 
> from within a plugin without too much hassle.
> 
> One option that we may consider is to move the GDALDataSetH from private 
> to protected so that you could at least inherit QgsRasterLayer to extend 
> it yourself.
> 
> Please keep us up to date with what you are working on. There are a 
> number of users who are interested in similar functionality and it would 
> be nice to see some joint effort putting together a nifty raster 
> manipulation plugin; components of which can be consider at a later time 
> for inclusion to the raster core.

Folks,

I would add there are mechanisms in GDAL to apply arbitrary processing
algorithms to imagery as it is read using virtual files.  For some applications
this might be appropriate.  I gather there is also some work going on for
pixel processing functions within the qgis raster renderer that might be
applicable for other purposes.

However, for the particular one mentioned, I think Pete's suggestion of
opening the file yourself is best.  I would note that datasets are normally
opened in readonly mode for the QgsRasterLayer, so it will be hard to use
this dataset handle to update files.  Opening an existing file for update
access, when it is already open for read access in another part of QGIS
could result in errors or even crashes in some circumstances.  So if you
want to do a sort of batch processing, writing the results to a new file
is the most safe approach.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the Qgis-developer mailing list