[GRASS5] Re: [GRASSLIST:10245] Re: v.in.ascii quirk

Stuart,

Seems we've found a bug, CCing to dev list.

On Fri, 10 Feb 2006 11:30:29 -0500
Stuart Edwards <sedwards2@cinci.rr.com> wrote:

Yes, I did have the ' ' in place. However when I run the GUI
without them, the .dbf file still is not created.

v.in.ascii input=/Users/stu/Desktop/grasstest/fivepoints output=fp
format=point 'fs='\'' '\''' skip=1 'columns=x double, y double, z
double,' x=1 y=2 z=3 cat=0 -z

To specify space as field seperator you can also use: space (literally).

The GUI appears to have inserted ' ' around the whole phrase
starting at 'columns rather than just around 'x double, etc.

Strange indeed. I haven't noticed it before. I have doublechecked and
interestingly v.in.ascii works in such form too, also from CLI. Could
Developers please comment what is this? Manual tells to use columns='x
double, y double', not 'columns=x double, y double'. Why both are
supported?

tried leaving the ' ' out of the field separator field with similar
results.

That should work as well as space.

Getting back to main problem: what I think is the actuall reason for
your dbf file being not created, is that v.in.ascii simply doesn't
create dbf file for 3D vectors it creates. Trying to sort out your case
I have just noticed it. I don't know if this is a feature or a bug.
Developers - is there any reason why 3D vectors should not have
attribute tables?

Please see this example:

### Creating 2D vector there is a dbf created:

$ echo "200.0 200.0 999.0" | v.in.ascii output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2
$ v.info -c onepoint
Displaying column types/names for database connection of layer 1:
INTEGER|cat
DOUBLE PRECISION|x
DOUBLE PRECISION|y
DOUBLE PRECISION|z

### But creating a 3D vector, dbf isn't created:

$ echo "200.0 200.0 999.0" | v.in.ascii -z output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2 z=3

$ v.info -c onepoint
Database connection for map <onepoint> is not defined in DB file

### Another thing - if I don't put -z flag but still specify the number
### of column for z coordinate, there's no error message, while
### I guess there should be:

$ echo "200.0 200.0 999.0" | v.in.ascii output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2 z=3
Maximum input row length: 18
Maximum number of columns: 3
Minimum number of columns: 3
Building topology ...
1 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 1
Number of primitives: 1
Number of points : 1
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/

Maciek
On page 3 of the v.in.ascii man page there is a cryptic note near the end:

'The 'point' string (or some similar entry) is required to generate a database table. When simply piping the coordinates (and optionally height) without additional column(s) into v.in.ascii, only the vector map geometry will be generated'

So it seems to be partly a feature and partly a bug, and there probably needs to be some review of the function and its GUI/CLI relationship as well as clarification of the man page. The above is actually the only reference I have seen to the creation of a database table in documentation. Other information is available by reverse engineering the error messages, but that's a hard way to go. It would seem useful to have database table generation as an option for all v.in.ascii input. Confirmation that a database table had been set up (or not) would be helpful in the output stream when the command is run.

Thanks for looking into this.

Stuart

On Feb 10, 2006, at 12:21 PM, Maciek Sieczka wrote:

Stuart,

Seems we've found a bug, CCing to dev list.

On Fri, 10 Feb 2006 11:30:29 -0500
Stuart Edwards <sedwards2@cinci.rr.com> wrote:

Yes, I did have the ' ' in place. However when I run the GUI
without them, the .dbf file still is not created.

v.in.ascii input=/Users/stu/Desktop/grasstest/fivepoints output=fp
format=point 'fs='\'' '\''' skip=1 'columns=x double, y double, z
double,' x=1 y=2 z=3 cat=0 -z

To specify space as field seperator you can also use: space (literally).

The GUI appears to have inserted ' ' around the whole phrase
starting at 'columns rather than just around 'x double, etc.

Strange indeed. I haven't noticed it before. I have doublechecked and
interestingly v.in.ascii works in such form too, also from CLI. Could
Developers please comment what is this? Manual tells to use columns='x
double, y double', not 'columns=x double, y double'. Why both are
supported?

tried leaving the ' ' out of the field separator field with similar
results.

That should work as well as space.

Getting back to main problem: what I think is the actuall reason for
your dbf file being not created, is that v.in.ascii simply doesn't
create dbf file for 3D vectors it creates. Trying to sort out your case
I have just noticed it. I don't know if this is a feature or a bug.
Developers - is there any reason why 3D vectors should not have
attribute tables?

Please see this example:

### Creating 2D vector there is a dbf created:

$ echo "200.0 200.0 999.0" | v.in.ascii output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2
$ v.info -c onepoint
Displaying column types/names for database connection of layer 1:
INTEGER|cat
DOUBLE PRECISION|x
DOUBLE PRECISION|y
DOUBLE PRECISION|z

### But creating a 3D vector, dbf isn't created:

$ echo "200.0 200.0 999.0" | v.in.ascii -z output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2 z=3

$ v.info -c onepoint
Database connection for map <onepoint> is not defined in DB file

### Another thing - if I don't put -z flag but still specify the number
### of column for z coordinate, there's no error message, while
### I guess there should be:

$ echo "200.0 200.0 999.0" | v.in.ascii output=onepoint fs=space
columns='x double, y double, z double' x=1 y=2 z=3
Maximum input row length: 18
Maximum number of columns: 3
Minimum number of columns: 3
Building topology ...
1 primitives registered
Building areas: 100%
0 areas built
0 isles built
Attaching islands:
Attaching centroids: 100%
Topology was built.
Number of nodes : 1
Number of primitives: 1
Number of points : 1
Number of lines : 0
Number of boundaries: 0
Number of centroids : 0
Number of areas : 0
Number of isles : 0

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/