[GRASSLIST:200] Confused about v.extract
Tom Russo
russo at bogodyn.org
Fri Mar 17 03:32:38 EST 2006
I'm trying to take a vector map of areas produced from r.to.vect and
turn it into a vector map of just lines, not areas. I am using grass61 cvs
updated earlier today (and again a few minutes ago).
I was thinking I could v.extract only the boundaries (no centroids) then v.type
the boundaries into lines. But I can't seem to extract boundaries at all
without also extracting centroids, no matter what I try.
v.info on the original vector map shows:
> v.info preseg1
[...]
| Type of Map: Vector (level: 2) |
| |
| Number of points: 0 Number of areas: 20 |
| Number of lines: 0 Number of islands: 2 |
| Number of boundaries: 443 Number of faces: 0 |
| Number of centroids: 20 Number of kernels: 0 |
| |
| Map is 3D: 0 |
| Number of dblinks: 1 |
Running v.extract:
v.extract input=preseg1 output=ps_b type=boundary
Building topology ...
0 primitives registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built.
Number of nodes : 0
Number of primitives: 0
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
Writing attributes ...
That is, I get an empty output map. (I also tried extracting type=area ---
that worked fine, but of course just produced a copy of the original vector
map)
Then I tried:
> v.type type=boundary,line input=preseg1 output=ps_b
Building topology ...
463 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 445
Number of primitives: 463
Number of points : 0
Number of lines : 443
Number of boundaries: 0
Number of centroids : 20
Number of areas : 0
Number of isles : 0
Number of centroids outside area : 20
So now I have a map of lines and centroids. Maybe I can v.extract the lines?
> v.extract -t input=ps_b output=ps_l type=line
Building topology ...
0 primitives registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built.
Number of nodes : 0
Number of primitives: 0
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
Nope.
But extracting the centroids works:
> v.extract -t input=ps_b output=ps_c type=centroid
Building topology ...
20 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 20
Number of primitives: 20
Number of points : 0
Number of lines : 0
Number of boundaries: 0
Number of centroids : 20
Number of areas : 0
Number of isles : 0
Number of centroids outside area : 20
And v.typing boundaries to lines, centroids to points, then extracting points
works fine, too:
> v.type type=boundary,line,centroid,point input=preseg1 output=ps_bc
Building topology ...
463 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 445
Number of primitives: 463
Number of points : 20
Number of lines : 443
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
> v.extract -t input=ps_bc output=ps_p type=point
Building topology ...
20 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 20
Number of primitives: 20
Number of points : 20
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0
but trying to extract lines from ps_bc fails the same way as all the others.
So what does a guy have to do to take a vector map of areas and turn it into
a pile of lines? Clearly I'm misunderstanding something.
(My purpose in all this is to combine the outlines of the original areas with
lines from another data source, break all the lines at intersections, then
ultimately turn the combined line map back into areas by turning lines
back into boundaries, attaching categories and centroids. Areas are derived
from elevation data (quantizing elevation ranges), the second vector layer is
trail data --- the object being to create a polygon map of areas between
trails that lie in a a particular range of elevations, as I have an application
that would use the resulting polygons. The
raster->areas->lines->patched maps->boundaries->areas approach seemed to be
what I needed, but I can't get step 2 to work. I'd be delighted if someone
has a better idea for how to do what I'm trying to do, as I'm just flailing
around trying to learn this stuff and guessing at techniques.)
--
Tom Russo KM5VY SAR502 DM64ux http://www.swcp.com/~russo/
Tijeras, NM QRPL#1592 K2#398 SOC#236 AHTB#1
"And, isn't sanity really just a one-trick pony anyway? I mean all you get is
one trick, rational thinking, but when you're good and crazy, oooh, oooh,
oooh, the sky is the limit!" --- The Tick
More information about the grass-user
mailing list