Vector Overlapping Areas: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
'''A:''' You can run this (example) - note that it won't work with the DBF driver but requires SQLite, PostgreSQL, MySQL, or... driver: | '''A:''' You can run this (example) - note that it won't work with the DBF driver but requires SQLite, PostgreSQL, MySQL, or... driver: | ||
# solution one | |||
v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory | v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory | ||
v.category input=fireHistory output=tmpFire type=centroid | v.category input=fireHistory output=tmpFire type=centroid | ||
v.db.addtable map=tmpFire table=tmpFire_2 layer=2 columns='cat int' | v.db.addtable map=tmpFire table=tmpFire_2 layer=2 columns='cat int' | ||
Line 11: | Line 14: | ||
# another solution (tested under SQLite) | # another solution (tested under SQLite) | ||
v.overlay ainput= | |||
v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory | |||
v.overlay ainput=fireHistory atype=area alayer=1 binput=fireHistory btype=area blayer=2 output=mf operator=or olayer=1,1,1 --overwrite | |||
v.db.renamecol map=mf layer=1 column=b_cat,countFires | v.db.renamecol map=mf layer=1 column=b_cat,countFires | ||
v.db.update map=mf layer=1 column=countFires value=1 where='countFires isnull' | v.db.update map=mf layer=1 column=countFires value=1 where='countFires isnull' | ||
# Export it to a raster layer: | |||
v.to.rast input=fireHistory layer=1 output=mf use=attr column=countFires | |||
[[Category: FAQ]] | [[Category: FAQ]] |
Revision as of 13:00, 8 July 2008
Q: How can I determine the number of overlapping features per location after import of SHAPE file?
A: You can run this (example) - note that it won't work with the DBF driver but requires SQLite, PostgreSQL, MySQL, or... driver:
# solution one v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory v.category input=fireHistory output=tmpFire type=centroid v.db.addtable map=tmpFire table=tmpFire_2 layer=2 columns='cat int' # Export it to a raster layer: v.to.rast input=tmpFire layer=2 output=mf use=attr column=num
# another solution (tested under SQLite) v.in.ogr dsn=./shp/ layer=fireHistory output=fireHistory v.overlay ainput=fireHistory atype=area alayer=1 binput=fireHistory btype=area blayer=2 output=mf operator=or olayer=1,1,1 --overwrite v.db.renamecol map=mf layer=1 column=b_cat,countFires v.db.update map=mf layer=1 column=countFires value=1 where='countFires isnull' # Export it to a raster layer: v.to.rast input=fireHistory layer=1 output=mf use=attr column=countFires