[GRASS-user] Converting raster to polygon creates too many
polygons
Micha Silver
micha at arava.co.il
Wed Sep 29 08:38:33 EDT 2010
On 09/29/2010 02:11 PM, Hanlie Pretorius wrote:
> Hi,
>
> I've created subcatchments using r.watershed and I would like to
> convert these to polygons. My result at the moment contains too many
> polygons - 194. The original raster had only 9 areas, which should all
> have been contiguous seeing that they came from r.watershed.
>
> Here is the sequence of commands that I use, starting with r.report
> for the information about the subcatchments raster:
> -----
> | Type of Map: raster Number of Categories: 18
> | Data Type: CELL
> | Rows: 33443
> | Columns: 33008
> | Total Cells: 1103886544
>
1.1 billion cells. Do you really need that ?
> | Projection: Transverse Mercator
> | N: -3122229.69982072 S: -3155672.30728643 Res: 0.99998826
> | E: -33474.90929218 W: -66483.27873573 Res: 1.00001119
> | Range of data: min = 2 max = 18
>
It's not 9 areas but 16 categories.
> -----
>
> # Set the resolution to 25m
> g.region rast=c83a_border res=25
>
I don't think changing resolution here will make any difference. (Unless
you rerun r.watershed after)
> # Convert the subcatchment raster to vector
> r.to.vect --overwrite
> input=c83a_dem_25m_clipped_basins_100000_clipped at PERMANENT
> output=c83a_subcatchments at PERMANENT feature=area
>
> v.report for the resulting vector gives me 194 categories. The
> original raster had only 9 areas, which should all have been
> contiguous seeing that they come from r.watershed.
>
>
You might be getting many small areas around the edges that are not
connected with any of the subcatchments.
Displaying the resulting vector should show you where the 194 areas are.
You might consider getting rid of these edge areas with
v.clean c83a_subcatchments tool=rmsa thresh=....
out=c83a_subcatchments_clean
(choose a threshold large enough to catch all the edge areas, but
smaller than any of the real subcatchments)
> What am I doing wrong? I want an output vector with 9 polygons
> corresponding to the original 9 areas in the subcatchment raster.
>
> Thanks
> Hanlie
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
> This mail was received via Mail-SeCure System.
>
>
>
--
Micha Silver
Arava Development Co. +972-52-3665918
http://surfaces.co.il
More information about the grass-user
mailing list