[GRASS-dev] removing small multiple polygons created by
r.stream.basin + r.to.vect
Margherita Di Leo
dileomargherita at gmail.com
Mon Apr 9 09:39:25 EDT 2012
Hi,
when I delineate a basin using r.stream.basins, and convert the raster map
of the basin into vector (r.to.vect), I sometimes get multiple polygons:
i.e. one bigger and a couple of one cell polygons. (you can reproduce the
behavior in NC sample dataset using easting=643677.87 northing=222800.246).
Since i need to remove the small polygons in a script, I would like to know
whether I can use:
grass.run_command('v.extract', list = 1,
input = v_basins,
output = v_basin,
type = 'area',
overwrite = True)
In fact, it seems to me that the bigger polygon is always listed as the
first record. Is that always true? Does r.to.vect (feature=area) always
list as first record the polygon with the larger area?
Or else, I should set a SQL query about the area. I've already tried
something like:
grass.run_command('v.extract', where = 'area = max(area)',
input = v_basins,
output = v_basin,
type = 'area',
overwrite = True)
but it seems that the SQL statement is incorrect ... I'm not experienced
with SQL.
Any idea?
Thanks,
madi
--
Ing. Margherita Di Leo, Ph.D.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20120409/14d825f8/attachment.html
More information about the grass-dev
mailing list