[GRASS-user] How to import KML polygons in GRASS?

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Mon Feb 25 00:14:05 EST 2008


Hamish,

thank you. You are always there... ;-)

On Sun, 2008-02-24 at 20:53 -0800, Hamish wrote:
> 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

I tried that in the past. I will re-check it.
> 
> 
> > 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.
> 
Checking that as well...
> 
> > 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.

hmmm... I see. -- yes I have it.
> 
> 
> If you find a nice solution could you add some instructions on the
> wiki?
> Including all the links people have mentioned.

If I make it "merging" all this advices I will definitely do that!
> 
> 
> 
> Hamish

Cheers,

Nikos
> 
> 
> 
>       ____________________________________________________________________________________
> Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
> 
> 
-- 
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel.  +49 (0) 761 203 3697 / Fax.  +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20080225/e3132ba5/attachment.bin


More information about the grass-user mailing list