I rewrote my file like this:
“X_COORDINATE”,“Y_COORDINATE”
L 2 1
3400630.04 5718486.603
3400639.238 5718515.776
1 1
L 2 1
3400639.238 5718515.776
3400648.641 5718546.057
1 2
L 2 1
3400648.641 5718546.057
3400665.041 5718562.99
1 3
L 2 1
3400665.041 5718562.99
3400625.996 5718597.349
1 4
Then I perform the import:
GRASS 6.2.1 (luenenxy):~ > v.in.ascii input=/home/jorge/GrassGIS/luenenxy/jorge/koord1.csv out=koord_grass format=standard --overwrite skip=1 cat=0 fs=‘space’
WARNUNG: Die Vektorkarte ‘koord_grass’ existiert bereits und wird
überschrieben.
Error reading ascii file:
Erzeuge Topologie …
4 primitives registriert
Building areas: 100%
0 Flächen erstellt
0 Inselflächen erstellt
Füge Inselflächen hinzu:
Füge Zentroide hinzu: 100%
Die Topologie wurde erstellt.
Anzahl von Knoten : 5
Anzahl von Primitives : 4
Anzahl von Punkten : 0
Anzahl von Linien : 4
Anzahl von Boundaries : 0
Anzahl von Zentroiden : 0
Anzahl von Flächen : 0
Anzahl von Inseln : 0
GRASS 6.2.1 (luenenxy):~ >
It seems to recognise the entities in the file but what does this error message means ???
Error reading ascii file:
???
Thanks in advace,
Jorge
Am Donnerstag, den 08.03.2007, 23:17 +0100 schrieb Moritz Lennert:
On 08/03/07 18:00, Jorge Echeverri wrote:
> Hi,
>
> I have to admit that I am an absolute beginner in GRASS.
>
> I need to import vector data from a text-file with this format:
> x-begin,y-begin,x-end,y-end
>
> Any suggestion?
v.in.ascii
You will have to transform your data (e.g. with awk) to fit the standard
format. Something like this (untested) should work:
awk -F"," 'BEGIN{i=0} {i++;print "L 2 1";print $1,$2,i;i++;print
$3,$4,i;print "1"}' YourFile | v.in.ascii -n format=standard
out=YourMapName fs=" "
See the v.in.ascii man page for details.
Moritz
I rewrote my file like this:
"X_COORDINATE","Y_COORDINATE"
L 2 1
3400630.04 5718486.603
3400639.238 5718515.776
1 1
L 2 1
3400639.238 5718515.776
3400648.641 5718546.057
1 2
L 2 1
3400648.641 5718546.057
3400665.041 5718562.99
1 3
L 2 1
3400665.041 5718562.99
3400625.996 5718597.349
1 4
Then I perform the import:
GRASS 6.2.1 (luenenxy):~ > v.in.ascii
input=/home/jorge/GrassGIS/luenenxy/jorge/koord1.csv out=koord_grass
format=standard --overwrite skip=1 cat=0 fs='space'
WARNUNG: Die Vektorkarte 'koord_grass' existiert bereits und wird
überschrieben.
Error reading ascii file:
Erzeuge Topologie ...
4 primitives registriert
Building areas: 100%
0 Flächen erstellt
0 Inselflächen erstellt
Füge Inselflächen hinzu:
Füge Zentroide hinzu: 100%
Die Topologie wurde erstellt.
Anzahl von Knoten : 5
Anzahl von Primitives : 4
Anzahl von Punkten : 0
Anzahl von Linien : 4
Anzahl von Boundaries : 0
Anzahl von Zentroiden : 0
Anzahl von Flächen : 0
Anzahl von Inseln : 0
GRASS 6.2.1 (luenenxy):~ >
It seems to recognise the entities in the file but what does this error
message means ???
(tip: you can force GRASS to talk English, by doing "LC_ALL=C; export
LC_ALL" from GRASS CLI first)
My guesses:
1. you don't need the "fs=" and "cat=" for "format=standard", it's for
"format=point" only
2. GRASS expects a header in a GRASS vector ASCII file; use "-n" to
avoid this
Use -n to omit checking for header in the input ASCII vector, like I
wrote before. Look into v.in.ascii, v.out.ascii and pages linked there
for details.
Erzeuge Topologie ...
4 primitives registriert
Building areas: 100%
0 Flächen erstellt
0 Inselflächen erstellt
Füge Inselflächen hinzu:
Füge Zentroide hinzu: 100%
Die Topologie wurde erstellt.
Anzahl von Knoten : 5
Anzahl von Primitives : 4
Anzahl von Punkten : 0
Anzahl von Linien : 4
Anzahl von Boundaries : 0
Anzahl von Zentroiden : 0
Anzahl von Flächen : 0
Anzahl von Inseln : 0
But the lines are rightly imported, so I guess this error message can be
ignored, isn't it?
Are you sure there was no more info about the error besides the:
Error reading ascii file:
as you quoted it? Strange.
Anyway, in 6.3 CVS v.in.ascii format=standard won't proceed with a
malformed or missing header if -n is not used. It might be different in
6.2.1 which you are using though. But that would be a bug.