I am trying to determine the area of each polygon in a layer, and store this statistic as a column in the attribute table (my vector attributes are stored in MySQL). There appears to be no vector function in the reference manual that provide this function, but I'm sure there must be something that does this. Please point me in the right direction.
Thanks,
C.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
On Wednesday 18 February 2004 16:53, Christopher Fonnesbeck wrote:
I am trying to determine the area of each polygon in a layer, and store
this statistic as a column in the attribute table (my vector attributes
are stored in MySQL). There appears to be no vector function in the
reference manual that provide this function, but I'm sure there must be
something that does this. Please point me in the right direction.
v.to.db option=area
More precisely/generally, it does not update each row in the table by area size
of each polygon, but by the sum of area sizes of all polygons with the same category.
Radim
On Wed, Feb 18, 2004 at 10:53:58AM -0500, Christopher Fonnesbeck wrote:
I am trying to determine the area of each polygon in a layer, and store
this statistic as a column in the attribute table (my vector attributes
are stored in MySQL). There appears to be no vector function in the
reference manual that provide this function, but I'm sure there must be
something that does this. Please point me in the right direction.
v.to.db should do the job:
option=string
Uploaded value: cat - insert new row for each category if doesn't exist yet area - area size
length - line length
count - number of features for each category
coor - point coordinates
query - result of a database query for all records of the geometry (or geometries) from table specified by 'qfield' option
Options: cat,area,length,count,coor,query
http://grass.itc.it/grass51/manuals/html57_user/v.to.db.html
Markus
On Feb 19, 2004, at 4:14 AM, Radim Blazek wrote:
I am trying to determine the area of each polygon in a layer, and store
this statistic as a column in the attribute table (my vector attributes
are stored in MySQL). There appears to be no vector function in the
reference manual that provide this function, but I'm sure there must be
something that does this. Please point me in the right direction.
v.to.db option=area
More precisely/generally, it does not update each row in the table by area size
of each polygon, but by the sum of area sizes of all polygons with the same category.
OK, it sounds like I will have to program something. I need the area of each polygon as an attribute field, since I am trying to classify stream segments by the size of the sub-basin that drains into it. The easiest thing, I suppose would be to take both coverages over to ArcView, since this is a trivial operation there (but that would be cheating, I guess ;-] )
C.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
On Thursday 19 February 2004 16:02, Christopher Fonnesbeck wrote:
On Feb 19, 2004, at 4:14 AM, Radim Blazek wrote:
>> I am trying to determine the area of each polygon in a layer, and
>> store
>> this statistic as a column in the attribute table (my vector
>> attributes
>> are stored in MySQL). There appears to be no vector function in the
>> reference manual that provide this function, but I'm sure there must
>> be
>> something that does this. Please point me in the right direction.
>
> v.to.db option=area
>
> More precisely/generally, it does not update each row in the table by
> area size
> of each polygon, but by the sum of area sizes of all polygons with the
> same category.
OK, it sounds like I will have to program something. I need the area of
each polygon as an attribute field, since I am trying to classify
stream segments by the size of the sub-basin that drains into it. The
easiest thing, I suppose would be to take both coverages over to
ArcView, since this is a trivial operation there (but that would be
cheating, I guess ;-] )
Why? What is the problem? Why you cannot use v.to.db?
If you don't have unique category for each polygon you can add it
by v.category.
Radim
On Feb 20, 2004, at 3:31 AM, Radim Blazek wrote:
I am trying to determine the area of each polygon in a layer, and
store
this statistic as a column in the attribute table (my vector
attributes
are stored in MySQL). There appears to be no vector function in the
reference manual that provide this function, but I'm sure there must
be
something that does this. Please point me in the right direction.
v.to.db option=area
More precisely/generally, it does not update each row in the table by
area size
of each polygon, but by the sum of area sizes of all polygons with the
same category.
OK, it sounds like I will have to program something. I need the area of
each polygon as an attribute field, since I am trying to classify
stream segments by the size of the sub-basin that drains into it. The
easiest thing, I suppose would be to take both coverages over to
ArcView, since this is a trivial operation there (but that would be
cheating, I guess ;-] )
Why? What is the problem? Why you cannot use v.to.db?
If you don't have unique category for each polygon you can add it
by v.category.
Well, my vector layer of polygons comes from a raster layer, via r.to.vect, which creates a mysql table with cat and value columns, and an empty label column. Then, running:
v.to.db map=basins type=boundary option=area units=h
gives me a dbmi protocol error. Is this because the table already exists? I am assuming this means I have to write some C code to get the areas, create a database column, and load the values.
C.
--
Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g )
Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia
On Friday 20 February 2004 14:33, Christopher Fonnesbeck wrote:
Well, my vector layer of polygons comes from a raster layer, via
r.to.vect, which creates a mysql table with cat and value columns, and
an empty label column. Then, running:
v.to.db map=basins type=boundary option=area units=h
gives me a dbmi protocol error. Is this because the table already
exists? I am assuming this means I have to write some C code to get the
areas, create a database column, and load the values.
The column must exist in the table (double precision) and must be specified (col1).
Radim