[GRASS-user] SOLVED Determining number of overlapping features
per location after import of shape file
Rainer M Krug
r.m.krug at gmail.com
Tue Jun 24 06:28:32 EDT 2008
Hi
I managed to solve it:
v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory
v.category input=fireHistory output=tmpFire
v.db.addtable map=tmpFire table=tmpFire_2 layer=2 columns='num,int'
v.to.db map=tmpFire layer=2 qlayer=1 option=query col=num
qcol='count(*)' type=centroid
finally I can export it to a raster layer:
v.to.rast input=tmpFire layer=2 output=mf use=attr column=num --overwrite
Could the code on the website
http://grass.osgeo.org/screenshots/vector.php please be updated, as it
is not working under grass 6.3 and less commands are necessary?
Is there a WIKI to which I could upload the code?
Thanks for your help,
Rainer
On Tue, Jun 24, 2008 at 10:32 AM, Rainer M Krug <r.m.krug at gmail.com> wrote:
> 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...
> 100%
> 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...
> 100%
> 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?
>
> Rainer
>
>>
>>
>> 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
>
--
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