[Qgis-developer] Shaded Relief python plugin available pyqgis, org

Tim Sutton lists at linfiniti.com
Sat Sep 19 09:16:36 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Andreas


Andreas Plesch wrote:
> Hello qgis developers,
> 
> I was looking for a way to compute a shaded relief map from a DEM
> without GRASS, and proceeded to use numpy as it was suggested on the
> rasterlang plugin web page. After fiddling with the python console in
> Qgis, I decided to tackle a plugin and it turned out to be tractable
> after getting over all of the windowing code and learning designer. I
> send a version of the plugin to Barry Rowlingson because I reuse his
> layerAsArray and writeGeoTiff rasterlang functions and he suggested
> some improvements. Since the shader plugin is in a usable form now, I
> went ahead and made it available on the pyqgis.org repository as
> shadedrelief.zip. Please feel free to test it and improve on it.
> 
> Apologies for the coding style, this is my first python experiment.
> 
> Right now, it would be nice to add a little preview in the dialog to
> see the effect of the parameters on the shading. I can see that I
> could take a scaled down copy of the array, apply the shading (would
> be quick on a 100x100 image), and display that. Presumably on a pixmap
> Qlabel, and I found a code fragment which converts a numpy array to a
> Qimage, so no file IO would be necessary.
> 
> What would be hard for me is to make that work nicely. I envision each
> change in the parameters triggers an update of the preview, or to have
> a dedicated update preview button. Perhaps this means that the UI is
> not a Qdialog anymore. And it presumably requires a Qaction which is
> tied to an update function. I would also need to put the shading
> itself into a function.
> 
> I also would need to load the layer before the ok clicking, presumably
> when the dialog is shown or initialized. Hopefully the update would be
> fast. Looking at the rastercatalog plugin for its raster previews I
> see that it uses threads to generate the previews. Maybe this would be
> required here as well.
> 
> All this overwhelms my python knowledge and curiosity by a significant
> margin at this point. Any pointers or tips welcome,
> 
> Andreas
> 
> 
> 
> 

I just tried your plugin out (I've been waiting for this!) and it worked
great. It would be a great addition to the qgis analysis lib if ever you
felt motivated to rewrite it in c++!

In the mean time here are two suggestions:

 -   let the user choose which layer to use from the list of already
loaded layers rather than just assuming the active layer is the one to
be used
 -  preserve no data values from the original dem.


Thanks for writing this!

Regards

Tim


- --

Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkq02a4ACgkQqk07qZdiYjeKwwCgjq7uv4aB2SMS95otjvHjAJWk
fKUAn3cozGn9k53V9YSBlby/LtF3kyiN
=v9jg
-----END PGP SIGNATURE-----


More information about the Qgis-developer mailing list