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
Hi,
2014-03-10 16:55 GMT+01:00 Markus Neteler <neteler@osgeo.org>:
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.
that's because the module skips features without category [1], so
`layer=-1` is your friend. I would say that current behaviour is very
confusing even for power user...
Or `type=area use=vertex` + `v.clean tool=rmdupl`
Martin
[1] http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.to.points/main.c#L205
--
Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa
Hi,
2014-03-10 18:16 GMT+01:00 Martin Landa <landa.martin@gmail.com>:
that's because the module skips features without category [1], so
`layer=-1` is your friend. I would say that current behaviour is very
confusing even for power user...
I added in r59226 warning about that, eg.
WARNING: 106 features without category in layer <1> skipped. Note that
features without category (usually boundaries) are not skipped when
'llayer=-1' is given.
Also note that you need to enter `d.vect layer=-1` to show such points...
Martin
--
Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa
On Mon, Mar 10, 2014 at 6:16 PM, Martin Landa <landa.martin@gmail.com> wrote:
2014-03-10 16:55 GMT+01:00 Markus Neteler <neteler@osgeo.org>:
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.
that's because the module skips features without category [1], so
`layer=-1` is your friend. I would say that current behaviour is very
confusing even for power user...
thank for the new warning in the code.
Or `type=area use=vertex` + `v.clean tool=rmdupl`
Honestly, still not that obvious...
I first searched in v.extract, perhaps have a new flag there to allow
that when type=point the extraction can be set to nodes or vertices?
Markus
[1] http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.to.points/main.c#L205
--
Martin Landa * http://geo.fsv.cvut.cz/gwiki/Landa