[GRASS-user] Determining number of overlapping features per location after import of shape file

Rainer M Krug r.m.krug at gmail.com
Tue Jun 24 04:32:46 EDT 2008

On Tue, Jun 24, 2008 at 9:57 AM, Hamish <hamish_b at yahoo.com> wrote:
>> Is there another way of getting the number of overlapping features
>> per cell?
> Hi,
> maybe this helps- you can try Radim's example from the vector screenshots page. (see GRASS 6.0 "Overlapping polygons" section)
> http://grass.osgeo.org/screenshots/vector.php
> Yes, funny place for tutorial material, but it demos some functionality.

Thanks Hamish - I found that one alredy, but it does not work:

OK - her is what I did:

> v.category  input=fire_p output=fire_c type=centroid  option=add --o  <<-- option field=2 does not exist any more?
WARNING: Vector map <fire_c> already exists and will be overwritten
Building topology ...
3901 primitives registered
Building areas:  100%
1220 areas built
54 isles built
Attaching islands:  100%
Attaching centroids:  100%
Topology was built.
Number of nodes     :   2735
Number of primitives:   3901
Number of points    :   0
Number of lines     :   0
Number of boundaries:   2746
Number of centroids :   1155
Number of areas     :   1220
Number of isles     :   54
Number of areas without centroid :   65
[Raster MASK present]

> echo "create table fire_c_2 (id int, num int)" | db.execute

> v.db.connect map=fire_c driver=dbf layer=2 table=fire_c_2 key=id -o
The table <fire_c_2> is now part of vector map <fire_c> and may be deleted
or overwritten by GRASS modules
[Raster MASK present]

 > v.to.db map=fire_c layer=2 option=cat col=id  <<-- option col1=
changed to col=
Updating database...
7 categories read from map
0 records selected from table
0 categories read from map exist in selection from table
6 categories read from map don't exist in selection from table
6 records updated/inserted
0 update/insert errors
[Raster MASK present]

 > v.to.db map=fire_c layer=2 qlayer=1 option=query column=num
qcolumn="count(*)" type=centroid <<-- option col1= changed to column=
 qcol= to qcolumn=
Reading data from the map...
Querying database...
DBMI-DBF driver error:
SQL parser error:
in statement:
SELECT count(*) FROM ...
Error in db_open_select_cursor()

I guess this is a problem with the dbf database? Is there any way of
solving this in dbf?


> Hamish

Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Plant Conservation Unit
Department of Botany
University of Cape Town
Rondebosch 7701
South Africa

More information about the grass-user mailing list