Quantcast

How to draw a polygon shapefile around raster pixels?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to draw a polygon shapefile around raster pixels?

boesiii
I have a raster which has pixel values representing slope percentages.  Is there a way to draw a boundary around specific areas (ex. around all pixels greater than 40)?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

ves nikos
On Wed, 2010-06-16 at 06:10 -0700, boesiii wrote:
> I have a raster which has pixel values representing slope percentages.  Is
> there a way to draw a boundary around specific areas (ex. around all pixels
> greater than 40)?

make a contour representing the slope percentage. then select the
percent you want, and if you want extract it as a new item

--
nikos ves <[hidden email]>

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

boesiii
Could you explain how to do that.  I am new to QGIS.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

Goyo
El mié, 16-06-2010 a las 10:19 -0700, boesiii escribió:
> Could you explain how to do that.  I am new to QGIS.

Raster > Contour



_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

boesiii
How do I add the Raster tools? I don't have the Raster menu.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

ves nikos
On Wed, 2010-06-16 at 11:19 -0700, boesiii wrote:
> How do I add the Raster tools? I don't have the Raster menu.

Raster tools will come as default with the next version of qgis which
will be out in a couple of months.

For now you can install the Raster tools, with the Plugin manager.
Search them under the name gdal tools or something similar. (try gdal or
raster, I dont remember atm)

--
nikos ves <[hidden email]>

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

Micha Silver
On 06/16/2010 09:44 PM, nikos ves wrote:

> On Wed, 2010-06-16 at 11:19 -0700, boesiii wrote:
>    
>> How do I add the Raster tools? I don't have the Raster menu.
>>      
> Raster tools will come as default with the next version of qgis which
> will be out in a couple of months.
>
> For now you can install the Raster tools, with the Plugin manager.
> Search them under the name gdal tools or something similar. (try gdal or
> raster, I dont remember atm)
>
>    
You can also try a different approach. You mentioed that you already
have a raster of slopes and you want vector polygons (? is that your
goal?) covering everywhere with slope >40.
You can run the GRASS module r.mapcalculator, select the slope raster
for  raster A then enter A>40 in the equation text box.
The result will be a raster of slopes, but only greater than 40.
Now do r.to.vect to convert to polygons...

--
Micha



--
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il


_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

ves nikos
On Wed, 2010-06-16 at 21:49 +0300, Micha Silver wrote:
> You can also try a different approach. You mentioed that you already
> have a raster of slopes and you want vector polygons (? is that your
> goal?) covering everywhere with slope >40.
> You can run the GRASS module r.mapcalculator, select the slope raster
> for  raster A then enter A>40 in the equation text box.
> The result will be a raster of slopes, but only greater than 40.
> Now do r.to.vect to convert to polygons...

I agree, that will take much less time.

Contour function for me always takes huge amount of time for me,
especially if its complex, like slope.

There are unlimited ways to extract information from data, you just need
to use your imagination and be a little patience until you learn your
way around!  

Qgis also has a map calculator plugin as well. You can find it, as
always, using the plugin manager
--
nikos ves <[hidden email]>

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

boesiii
I tried using r.mapcalc with "slope_gt40_map=if(47001310ee>=40,1)" and all I get is a black raster and every pixel has a value of 1.

I also tried using r.mapcalculator with "A>40" but the resulting raster still has pixel values less than 40.

What is the correct code I should be using for either tool?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

ves nikos
On Thu, 2010-06-17 at 10:00 -0700, boesiii wrote:
> I tried using r.mapcalc with "slope_gt40_map=if(47001310ee>=40,1)" and all I
> get is a black raster and every pixel has a value of 1.
>
> I also tried using r.mapcalculator with "A>40" but the resulting raster
> still has pixel values less than 40.
>
> What is the correct code I should be using for either tool?
With grass:
using the contour:

r.contour input=slope@slope output=valid levels=40 cut=0 --overwrite

Using the mapcalc:

r.mapcalc "valid_raster" = "( "slope@slope" > 40)"

*Pro tip: Before you start, set the resolution at about ~200m otherwise
you might not like the results-> g.region res=200

--
nikos ves <[hidden email]>

_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

boesiii
Nikos,

I tried "r.contour input=slope@slope output=valid levels=40 cut=0 --overwrite" and it analyzes the raster but doesn't produce any contour lines.  Do I need to have a vector layer in the mapset?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

boesiii
I finally figured it out, I had my region set wrong.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a polygon shapefile around raster pixels?

sabb
In reply to this post by boesiii
boesiii

Not sure how you can do it in QGIS. Someone might have already mentioned GRASS tools to do it. These are the modules helping you to convert your raster to vector:

r.null  >> set all the values (or range of values you want NOT to be included in your output)

r.null map= YOURMAP setnull=-100-40

-100 is your lower band
40 is the higher band

Convert the raster to vector

r.to.vect -s input=YOURMAP output=VECTOROUTPUT feature=area

in the above command, each value will turn into a grid cell (the same size as your region setting e.g. 5 x 5)

If you want to have all of the cells merged into one polygon, you can create a MASK out of your raster (YOURMAP) and convert the MASK into the vector.

Cheers
Sab







_______________________________________________
Qgis-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-user
Loading...