[GRASSLIST:6824] Re: struggling with v.in.ascii

Robert Nuske rnuske at gwdg.de
Fri May 20 05:38:23 EDT 2005


Hi Hamish,

thanks for your consideration.
robert

>> I am using GRASS on a debian/testing system, but grass compiled from
source.
>
> Same here.
>
> 32bit i386 standard everything? compile time optimizations?

yep, very standard.
Do you mean the CFLAGS? CFLAGS="-O3 -mcpu=pentium"



> Did you try the Debain 6.0.0 package? (v.in.ascii has been updated since
then for MacOS9 input file support [ie G_getl2()]).

I've got the grass version 6.0.0-1 (and most of stuff from Debian-GIS)
just tried it again, it's the same there.


> It works fine for me using the sample data below.

that's what I feared.
I am the only one, who did something weird to his v.in.ascii.


> can you send this file to me as a gzip'd attachment? (to preserve any
weird newlines, etc)

yep, attached it.


>> Looking at the code:
>> The function points_analyse (called in in.c, line 195) goes through the
input file and  should write, amongst other things, the lines
containing actual data to the file tmpascii.
>
> Yes; I don't know how necessary it is to write out the entire datafile
as an intermediary step but that's the way it is right now.
>
>
>> But, I found tmpascii to be empty after this function call (printed
ascii and tmpascii to stdout => ascii: copy of input file and
>> tmpascii: nothing)
>> That's why the function points_to_bin (called in in.c, line 385) cannot
fetch any data.
>
> why "w+" and not "w" on line 190 of in.c?
>
>    tmp = G_tempfile();
>    if (NULL == (tmpascii = fopen(tmp, "w+"))) {
>
>
>
> *** ==> Does the following work? <== ***
>
> GRASS> g.tempfile pid=$$

yep

GRASS 6.1.cvs (aberfoyle61):~ > g.tempfile pid=$$
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/.tmp/ufobiw/2059.0


>> The while-loop in (points.c, line 172) is never entered, because the
>> file G_getl2 is supposed to read is empty.
>
> yup.
>
>
>> What I don't understand is that writing of a dataline to tmpascii in
>> the function points_analyse (points.c, line 90) seems to be
>> successful. The return value of fprintf states 29 chars were written.
>> When I write the same to stdout it looks okay, as well. What happens
>> to tmpascii ?
>
> temp files are stored in $MAPSET/.tmp/$HOST/  anything in there?

yes:
> ls -la
total 8
drwxr-xr-x  1 rnuske rnuske 4096 May 20 11:15 .
drwxr-xr-x  1 rnuske rnuske 4096 May 17 19:02 ..
-rwxr--r--  1 rnuske rnuske    0 May 20 11:14 2059.0



> g.gisenv set="DEBUG=5"

i didn't find it to be very helpful. the only thing i gathered from its
output is that v.in.ascii cannot read tmpascii

but, i put the output of a call of v.in.ascii with DEBUG=5 at the very end
of this mail



>> v.in.ascii works just perfect, if I put "ascii" instead of "tmpascii"
>> in the call of the function points_to_bin (in.c line 385).
>
>
> Is that what these next two cases represent?

yes, the first is the result of a call to the standard v.in.ascii and the
second is the output of a v.in.ascii where i cahnged the call of
points_to_bin ("ascii" instead of "tmpascii")


>> GRASS 6.1.cvs (aberfoyle61):~ > v.in.ascii in=points.txt format=point
>> \ fs=' ' out=test1
>> Maximum input row length: 29
>> Maximum number of columns: 4
>> Minimum number of columns: 4
>> column: 1  type: double
>> column: 2  type: double
>> column: 3  type: double
>> column: 4  type: integer
>> 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
>>
>>
>> GRASS 6.1.cvs (aberfoyle61):~ > v.in in=points.txt format=point \
>> fs=' ' out=test2
>> Maximum input row length: 29
>> Maximum number of columns: 4
>> Minimum number of columns: 4
>> column: 1  type: double
>> column: 2  type: double
>> column: 3  type: double
>> column: 4  type: integer
>> Building topology ...
>> 5 primitives registered
>> Building areas:  100%
>> 0 areas built
>> 0 isles built
>> Attaching islands:
>> Attaching centroids:  100%
>> Topology was built.
>> Number of nodes     :   4
>> Number of primitives:   5
>> Number of points    :   5
>> Number of lines     :   0
>> Number of boundaries:   0
>> Number of centroids :   0
>> Number of areas     :   0
>> Number of isles     :   0

v.in.ascii with DEBUG=5
=====================================================================

GRASS 6.1.cvs (aberfoyle61):~ > v.in.ascii in=points.txt fs=' '
format=point out=test3
D2/5: Vect_open_new(): name = test3
D1/5: Vect_set_thresh(): thresh = 0.000000
D1/5: V1_open_new_nat(): name = test3
D1/5: Vect_get_thresh(): thresh = 0.000000
D1/5: dig__write_head()
D1/5: write coor size (0) to head
D2/5: coor body offset 14
D3/5: dig_init_plus()
D1/5: dig_spidx_init()
D3/5: dig_cidx_init()
D3/5: Vect_hist_command()
D3/5: G_recreate_command()
D5/5: Vect_hist_write()
D5/5: Vect_hist_write()
D5/5: Vect_hist_write()
D5/5: Vect_hist_write()
D5/5: Vect_hist_write()
D4/5: G_getl2: ->248445.02 700247.69 39.31 66<-
D3/5: row 1 : 28 chars
D4/5: row 1 col 0: '248445.02' is_int = 0 is_double = 1
D4/5: row 1 col 1: '700247.69' is_int = 0 is_double = 1
D4/5: row 1 col 2: '39.31' is_int = 0 is_double = 1
D4/5: row 1 col 3: '66' is_int = 1 is_double = 1
D4/5: G_getl2: ->248445.02 700247.88 39.36 56<-
D3/5: row 2 : 28 chars
D4/5: row 2 col 0: '248445.02' is_int = 0 is_double = 1
D4/5: row 2 col 1: '700247.88' is_int = 0 is_double = 1
D4/5: row 2 col 2: '39.36' is_int = 0 is_double = 1
D4/5: row 2 col 3: '56' is_int = 1 is_double = 1
D4/5: G_getl2: ->248445.02 700248.06 39.22 50<-
D3/5: row 3 : 28 chars
D4/5: row 3 col 0: '248445.02' is_int = 0 is_double = 1
D4/5: row 3 col 1: '700248.06' is_int = 0 is_double = 1
D4/5: row 3 col 2: '39.22' is_int = 0 is_double = 1
D4/5: row 3 col 3: '50' is_int = 1 is_double = 1
D4/5: G_getl2: ->248445.02 700248.00 39.13 50<-
D3/5: row 4 : 28 chars
D4/5: row 4 col 0: '248445.02' is_int = 0 is_double = 1
D4/5: row 4 col 1: '700248.00' is_int = 0 is_double = 1
D4/5: row 4 col 2: '39.13' is_int = 0 is_double = 1
D4/5: row 4 col 3: '50' is_int = 1 is_double = 1
D4/5: G_getl2: ->248445.02 700248.00 39.12 50<-
D3/5: row 5 : 28 chars
D4/5: row 5 col 0: '248445.02' is_int = 0 is_double = 1
D4/5: row 5 col 1: '700248.00' is_int = 0 is_double = 1
D4/5: row 5 col 2: '39.12' is_int = 0 is_double = 1
D4/5: row 5 col 3: '50' is_int = 1 is_double = 1
D4/5: G_getl2: -><-
Maximum input row length: 29
Maximum number of columns: 4
Minimum number of columns: 4
D1/5: Vect_default_field_info(): map = test3 field = 1
D2/5: drv = dbf db = $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/
D3/5: Vect_subst_var(): in = $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/, map =
test3, mapset= trial_1
D3/5:   -> /home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/dbf/
D3/5: db_start_driver_open_database():
  drvname = dbf, dbname =
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/dbf/
D2/5: DBF: db__driver_open_database() name =
'/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/dbf/'
D2/5: db.name =
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/dbf/
D2/5: add_table(): table = stand1_first name = stand1_first.dbf
D2/5: add_table(): table = test name = test.dbf
D2/5: add_table(): table = test1 name = test1.dbf
D2/5: add_table(): table = test2 name = test2.dbf
D2/5: add_table(): table = stand1_last name = stand1_last.dbf
D2/5: Begin transaction
column: 1  type: double
column: 2  type: double
column: 3  type: double
column: 4  type: integer
D3/5: Vect_check_dblink: field 1
D1/5: Vect_write_dblinks(): map = test3, mapset = trial_1
D1/5: dbln file:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/dbln
D1/5: 1 test3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/5: Dblinks written
D3/5: create table test3 ( cat integer, dbl_1 double precision, dbl_2
double precision,dbl_3 double precision, int_1 integer )
D3/5: SQL statement parsed successfully
D2/5: find_table(): table = test3
D2/5:   ? stand1_first
D2/5:   ? test
D2/5:   ? test1
D2/5:   ? test2
D2/5:   ? stand1_last
D2/5: add_table(): table = test3 name = test3.dbf
D2/5: find_table(): table = test3
D2/5:   ? stand1_first
D2/5:   ? test
D2/5:   ? test1
D2/5:   ? test2
D2/5:   ? stand1_last
D2/5:   ? test3
D3/5: add_column(): tab = 5, type = 2, name = cat, width = 11, decimals = 0
D3/5: add_column(): tab = 5, type = 3, name = dbl_1, width = 20, decimals = 6
D3/5: add_column(): tab = 5, type = 3, name = dbl_2, width = 20, decimals = 6
D3/5: add_column(): tab = 5, type = 3, name = dbl_3, width = 20, decimals = 6
D3/5: add_column(): tab = 5, type = 2, name = int_1, width = 11, decimals = 0
D4/5: Vect_map_del_dblink() field = 1
D1/5: Vect_write_dblinks(): map = test3, mapset = trial_1
D1/5: dbln file:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/dbln
D1/5: Dblinks written
D3/5: Vect_check_dblink: field 1
D1/5: Vect_write_dblinks(): map = test3, mapset = trial_1
D1/5: dbln file:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/dbln
D1/5: 1 test3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/5: Dblinks written
D4/5: G_getl2: -><-
D2/5: Commit transaction
D2/5: save_table 0
D2/5: save_table 1
D2/5: save_table 2
D2/5: save_table 3
D2/5: save_table 4
D2/5: save_table 5
D2/5: Write table to tempfile:
'/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/.tmp/ufobiw/2130.dbf'
D2/5: Write 0 rows
D2/5: Written 0 records
D3/5: Vect_build(): build = 4
Building topology ...
D2/5: dig_cidx_free()
D3/5: dig_cidx_init()
D3/5: Vect_build_nat() build = 4
D1/5: Vect_Rewind(): name = test3
Registering lines: D3/5: Vect_read_next_line()
D3/5: V1_read_next_line_nat()
D3/5: Vect__Read_line_nat: offset = 14
0 primitives registered
0 areas built
0 isles built
Attaching islands:
Attaching centroids: Topology was built.
D2/5: dig_cidx_sort()
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
D1/5: Vect_close(): name = test3, mapset = trial_1, format = 0, level = 2
D1/5: get coor info:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/coor
D1/5: Info->size = 14, Info->mtime = 1116581619
D1/5: Vect_save_topo()
D1/5: Open topo:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/topo
D2/5: topo body offset 142
D2/5: topo body offset 142
D2/5: Vect_cidx_save()
D2/5: Open cidx:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/cidx
D3/5: dig_write_cidx_head()
D3/5: cidx body offset 13
D3/5: dig_write_cidx_head()
D3/5: cidx body offset 13
D1/5: close history file
D1/5: V1_close_nat(): name = test3 mapset= trial_1
D1/5: get coor info:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/coor
D1/5: Info->size = 14, Info->mtime = 1116581619
D1/5: dig__write_head()
D1/5: write coor size (14) to head
D2/5: coor body offset 14
D1/5: Vect_get_thresh(): thresh = 0.000000
D1/5: Vect_write_dblinks(): map = test3, mapset = trial_1
D1/5: dbln file:
/home/rnuske/luftbild/robert/grassdata/aberfoyle61/trial_1/vector/test3/dbln
D1/5: 1 test3 cat $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ dbf
D1/5: Dblinks written

-------------- next part --------------
A non-text attachment was scrubbed...
Name: points.txt.gz
Type: application/x-gzip
Size: 89 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20050520/b02e6b2d/points.txt.gz


More information about the grass-user mailing list