[Qgis-user] line in dem from max to min

Nicolas Cadieux nicolas.cadieux at archeotec.ca
Wed Jul 8 06:53:08 PDT 2015


Hi, 
In my earlier response, I thought you need the values along the borders of the polygons only.  Reading this response, I realized that this is most likely not the case.  
There are a few plugins  in QGIS that will use raster group statistics based on a vector layer.  The problem I had was that until a few months ago, when I used them, is that the multipolygone were not supported in at least one of the modules (LecoS) so I had to split them. 
This may has been solved since. 
Filter for "statistics" on the QGIS plugin page and then you will find a few plugins.  One is "ZonalStats " and one is "[237] LecoS - Landscape Ecology Statistics". 
Saga may have modules also. 
I all else fails Micha's solution seems good. 
Nicolas Cadieux M.Sc. 
Les Entreprises Archéotec inc.  
8548, rue Saint-Denis Montréal H2P 2H2 
Téléphone: 514.381.5112  Fax: 514.381.4995 
www.archeotec.ca 
On Jul 8, 2015 2:21 AM, "Micha Silver [via OSGeo.org]" <ml-node+s1560n5214779h10 at n6.nabble.com> wrote: 

	
v.botz wrote 
Hi,
i have some geometrys (multipolygon) and a dem (digital elevation model)
-> I need a line from the max value to the lowest value of the dem, for every multipolygon
is qgis a tool i could use - or do i need PostGIS ?
how could i realize this problem ??
any ideas?  THANKS


I can see a possible solution using GRASS. It's a bit complicated, but *should* work.
Starting with the vector module v.rast.stats you can add to your polygons the minimum and maximum elevation values for each polygon as new attribute columns.
Now you need to loop thru all the polygons (using your favorite scripting language). The v.db.select module will give a list of cat values and the min/max from above. Loop thru that list and for each cat value create a raster mask based on that polygon: something like 
r.mask raster=MASK vector=<polygons> cats=<the current cat value>. 
Then, with that mask in place, use an r.mapcalc expression to create a new raster with only the min/max values. Such as: 
r.mapcalc --o "min_max = if(dem>=max OR dem<=min, dem, null() )"
All other raster cells will be NULL. Now convert this new raster to a point vector. It will have only two points, the min and max elevation within the current polygon. And using those two points, create your line.
Finally remove the mask and loop to the next...
 
HTH,
Micha

	
	
	
	
	
	
	
		If you reply to this email, your message will be added to the discussion below: 
		http://osgeo-org.1560.x6.nabble.com/line-in-dem-from-max-to-min-tp5214619p5214779.html 
	
	
		To start a new topic under Quantum GIS - User, email ml-node+s1560n4125267h38@n6.nabble.com 
		To unsubscribe from Quantum GIS - User, click here . 
		NAML 
	



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/line-in-dem-from-max-to-min-tp5214619p5214868.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150708/0175447a/attachment.html>


More information about the Qgis-user mailing list