Details Ticket 5263


Comment | Reply | Resolve


Serial Number 5263
Subject r.to.vect: -v flag doesn't transfer cat values
Area grass6
Queue grass
Requestors hamish_nospam@yahoo.com
Owner mlanda
Status open
Last User Contact Wed Apr 25 18:47:55 2007 (1 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Wed Apr 25 18:47:55 2007 (1 yr ago)
Created Thu Nov 9 06:32:54 2006 (2 yr ago)

Transaction History Ticket 5263


Thu, Nov 9 2006 06:32:54    Request created by hbowman  
Subject: r.to.vect: -v flag doesn't transfer cat values

Hi,

If I make a stream map with r.watershed,
then 

r.null rwater.stream setnull=0
r.to.vect -v in=rwat.stream out=rwat_stream feature=line

Extracting lines ...  100%
 100%
Building topology ...
17 primitives registered      
Building areas:  100%
0 areas built      
0 isles built
Attaching islands: 
Attaching centroids:  100%
Topology was built.
Number of nodes     :   24
Number of primitives:   17
Number of points    :   0
Number of lines     :   17
Number of boundaries:   0
Number of centroids :   0
Number of areas     :   0
Number of isles     :   0
r.to.vect complete.


the vector map is created but the lines have no cats
v.info:
 |   Number of dblinks:      0     

the input map is CELL, raster range is min=2 max=64.
the -v flag was used with r.to.vect.

G63> db.connect -p  
driver:dbf
database:$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
schema:(null)
group:(null)


?

thanks,
Hamish
Tue, Feb 6 2007 23:14:16    Mail sent by msieczka  
hbowman wrote (Thu, Nov 9 2006 06:32:54):

> Subject: r.to.vect: -v flag doesn't transfer cat values

Without -v the categories are not assigned for feature=line either. This is
propably not desired, but not a bug deal as one can use v.category later.

However, in case of -v I guess that v.category not assigning the categories
makes a sane thing. Because, how to assing input raster lines values as
categories to output vector lines, when they are overlapping input raster
cells of different value, .eg:

http://kufaya.googlepages.com/lines.png

Looks like r.to.vect feauture=line cares only about the line's shape, and it's
propably doing it by design. Am I thinking any good here? Do we call it a
feature? Shall I document this?

> the vector map is created but the lines have no cats
> v.info:
>  |   Number of dblinks:      0     

FWIW, this is not a proof for a lack of categories. A vector can have
categories and no dblinks. v.category option=report would do instead.

Maciek
Wed, Feb 21 2007 17:20:36    Taken by mlanda  
Wed, Feb 28 2007 16:57:04    Comments added by mlanda  
Attributes for lines are not ignored (fixed in CVS today). But the problem
with overlapping input raster cells of different value remains. Could be
called as the feature?
Sat, Mar 3 2007 11:09:00    Comments added by msieczka  
Cc: hamish_nospam@yahoo.com,grass-dev@grass.itc.it

mlanda wrote (Wed, Feb 28 2007 16:57:04):

> Attributes for lines are not ignored (fixed in CVS today). But the problem
> with overlapping input raster cells of different value remains. Could be
> called as the feature?

Martin,

After you enabled attribute transfer for feature=line, it shows there is bug
there. Attributes are not transferred correctly from raster to vector lines.
In spearfish, do:

$ r.thin roads out=roads_thin
$ r.to.vect input=roads_thin output=roads_thin_vect feature=line
$ r.to.vect -v input=roads_thin output=roads_thin_vect_cat feature=line

Display them all and take a closer look at the horizontal roads located near
599447(E) 4921873(N). Query the input raster roads_thin. As you can see the
values of lines on the left and right should be 5 and 4, respectively.
However, in roads_thin_vect there is only one line there, having value=4. In
roads_thin_vect_cat on the other hand, there are 2 lines with cat=5 on the
left and cat=4 on the right, but the line with cat=4 is about 740m too long.
Maybe that's why it was never enabled, ?.

Maciek
Mon, Mar 5 2007 15:29:19    Comments added by mlanda  
You are right, it is bug. I hope now fixed in CVS. Can you confirm it?
Wed, Apr 25 2007 18:47:55    Mail sent by msieczka  
Hi Martin

Sorry for long time no reply. Your fix has improved the situation but there is
still something wrong. Please try the following to reproduce, if you would
like to look into the issue:

in spearfish:

g.region rast=roads -a
r.thin roads out=roads_thin
r.to.vect -v input=roads_thin output=roads_thin_vect_cat feature=line

g.region n=4922490 s=4921260 e=600300 w=598620 res=30 -a
d.rast roads_thin
d.vect -c roads_thin_vect_cat 

Please note the line of cat 4 overlaps cells of value 5, and the vector line
of cat 5 is half the region resolution too short.



Now look at another part:

g.region n=4922310 s=4921440 e=602640 w=601500 res=30 -a

There is a bogus red dangle (cat 2) in the center as you can see.

Maciek
Comment | Reply | Resolve

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request