<p dir="ltr">Hi,<br>
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. </p>
<p dir="ltr">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. </p>
<p dir="ltr">This may has been solved since. </p>
<p dir="ltr">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".</p>
<p dir="ltr">Saga may have modules also.</p>
<p dir="ltr">I all else fails Micha's solution seems good.<br></p>
<p dir="ltr">Nicolas Cadieux M.Sc.<br>
Les Entreprises Archéotec inc. <br>
8548, rue Saint-Denis Montréal H2P 2H2<br>
Téléphone: 514.381.5112 Fax: 514.381.4995<br>
www.archeotec.ca</p>
<div class="gmail_quote">On Jul 8, 2015 2:21 AM, "Micha Silver [via OSGeo.org]" <<a href="/user/SendEmail.jtp?type=node&node=5214868&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:<br type='attribution'><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em"><div>
<div style="font-weight:bold">v.botz wrote</div>
<div>Hi,
<br /><br />i have some geometrys (multipolygon) and a dem (digital elevation model)
<br />-> I need a line from the max value to the lowest value of the dem, for every multipolygon
<br /><br />is qgis a tool i could use - or do i need PostGIS ?
<br /><br />how could i realize this problem ??
<br /><br />any ideas? THANKS
</div>
</div></blockquote>
I can see a possible solution using GRASS. It's a bit complicated, but *should* work.
<br /><br />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.
<br />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
<br />r.mask raster=MASK vector=<polygons> cats=<the current cat value>.
<br />Then, with that mask in place, use an r.mapcalc expression to create a new raster with only the min/max values. Such as:
<br />r.mapcalc --o "min_max = if(dem>=max OR dem<=min, dem, null() )"
<br /><br />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.
<br />Finally remove the mask and loop to the next...
<br />
<br />HTH,
<br />Micha
<br />
<br />
<hr noshade="noshade" size="1" />
<div style="color:#444;font:12px 'tahoma' , 'geneva' , 'helvetica' , 'arial' , sans-serif">
<div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
<a href="http://osgeo-org.1560.x6.nabble.com/line-in-dem-from-max-to-min-tp5214619p5214779.html" target="_top" rel="nofollow" link="external">http://osgeo-org.1560.x6.nabble.com/line-in-dem-from-max-to-min-tp5214619p5214779.html</a>
</div>
<div style="color:#666;font:11px 'tahoma' , 'geneva' , 'helvetica' , 'arial' , sans-serif;margin-top:0.4em;line-height:1.5em">
To start a new topic under Quantum GIS - User, email ml-node+s1560n4125267h38@n6.nabble.com <br />
To unsubscribe from Quantum GIS - User, <a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4125267&code=bmljb2xhcy5jYWRpZXV4QGFyY2hlb3RlYy5jYXw0MTI1MjY3fDYzNDQ4MjQxNg==">click here</a>.<br />
<a href="http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" style="font:9px serif">NAML</a>
</div></blockquote></div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/line-in-dem-from-max-to-min-tp5214619p5214868.html">Re: line in dem from max to min</a><br/>
Sent from the <a href="http://osgeo-org.1560.x6.nabble.com/Quantum-GIS-User-f4125267.html">Quantum GIS - User mailing list archive</a> at Nabble.com.<br/>