[GRASS-dev] G7: how to extract nodes from vector map?

Markus Neteler neteler at osgeo.org
Mon Mar 10 08:55:51 PDT 2014


Hi,

I try to extract nodes from a vector grid in GRASS 7. The idea is to
extract pixel corners as vector points but it fails for me:

Sample routine
# NC 7, http://grass.osgeo.org/download/sample-data/  --> GRASS 7 full data

g.region n=222800 s=222740 w=642590 e=642670 nsres=10 ewres=10 -p
d.mon wx0
sleep 5 # otherwise wx0 will not show anything...

d.rast aspect

# generate a vector area map:
r.to.vect input=aspect output=aspect_grid type=area
d.vect aspect_grid

# Now we have the vector grid map, how to extract the nodes of the
intersections?

v.to.points input=aspect_grid output=aspect_grid_nodes use=node
# verify
d.rast aspect
d.vect aspect_grid_nodes col=red
## --> No, v.to.points extracts the centroids!

v.to.points input=aspect_grid output=aspect_grid_nodes use=node
type=boundary --o
## --> No: v.to.points complete. 0 points written to output vector map.

... no idea.

Note: The d.vect command uses:
        Vect_get_node_coor(Map, el, &X, &Y, NULL);

which are the desired grid nodes (boundary intersections).

How to extract the nodes as a new map (in a not overcomplicated way)?

thanks
Markus


More information about the grass-dev mailing list