[GRASSLIST:5212] Re: Converting polygon maps to graphs

swlab swlab at cornell.edu
Tue Dec 21 18:33:41 EST 2004


On Saturday 18 December 2004 02:53, Radim Blazek wrote:
> swlab wrote:
> > Hello,
> > I have a vector map of polygons, and I'd like to transform it as a graph
> > (ie, each polygon centroid would be a node, 2 nodes would be connected if
> > the polygons they represent share a common boundary...)
>
> You can get list of adjacent areas using v.to.db option=sides
> then write a script.

Radim, 
Thanks for your answer. Doesn't seem to work in my case, though 
(GARSS-5.7.cvs-2004/12/04):
The vector map I use was created from a raster, via
r.to.vect  -sv i=RASTER o=VECTOR feat=area
Boundaries created that way don't seem to be recognized properly: for example, 
a 
'd.vect VECTOR ty=boundary cats=1,6,9'
won't display anything (a 
'd.vect VECTOR ty=boundary'
gives proper results, though. It's just that I can't select particular 
areas...)
When I run v.to.db, I have a -1|0|0 result, and that's all

I wonder whether I really understood the fundamentals of vector maps. Could 
you point me to some info ?

Thx again
P.

-- 
Soil and Water Laboratory
Dept. of Biological and Environmental Engineering
Cornell University
Riley Robb Hall
ITHACA, NY 14853




More information about the grass-user mailing list