[GRASS-user] How to import KML polygons in GRASS?
Hamish
hamish_b at yahoo.com
Sun Feb 24 23:53:04 EST 2008
Nikos Alexandris wrote:
> Maybe I am just loosin' my time struggling to import KML polygons in
> GRASS but here is my attempt and my problems.
You might try using v.in.gpsbabel,
http://www.gpsbabel.org/htmldoc-1.3.0/fmt_kml.html
http://www.gpsbabel.org/htmldoc-1.3.0/fmt_google.html
> The problem is that the coordinates are given in form of x,y,z but
> continuously... that is one "x,y,z" field after another separated by
> "space" and not in separate lines!
>
> It looks like this:
>
> x1,y1,z1 x2,y2,z2 x3,y3,z3 [...] xi,yi,zi
>
> and NOT like this:
>
> x1,y1,z1
> x2,y2,z
> x3,y3,z3
> [...]
> xi,yi,zi
perhaps:
cat infile | tr ' ' '\n' > outfile
edit outfile, add "L "
v.in.ascii
or search & replace in nedit or some nice editor.
?
see v.in.garmin, v.in.gpsbabel for awk magic to add "L number" to lines
automatically.
> 7. If this is going to work I was thinking to "grep" somehow the
> metadata out of the "saved as txt file" and force it with a script in
> the X.grass-ready ascii
see v.in.garmin, v.in.gpsbabel for ideas on creating a DB table and
linking it to lines by cat number.
> * ogr officially supports "KML" reading and writing. I can't read
> with ogrinfo any KML file. I have read about "expat" support...
> but isn't this activated by default in ogr coming with FWTools?
fyi expat:
$ apt-cache show libexpat1
....
Description: XML parsing C library - runtime library
This package contains the runtime, shared library of expat, the C
library for parsing XML.
If you find a nice solution could you add some instructions on the
wiki?
Including all the links people have mentioned.
Hamish
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the grass-user
mailing list