[gdal-dev] .kml to .xlsx or .xls ( with Geometry Column Included)

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Wed Nov 27 05:24:05 PST 2019


Hi,

The documentation is probably mostly copied from the read-only XLS driver
documentation https://gdal.org/drivers/vector/xls.html and the VRT
capabilities refer to the possibility to build geometries from X and Y
fields, or from a field that contains Well Known Text as documented in
https://gdal.org/drivers/vector/vrt.html#vector-vrt.

The best that you can do with converting a simple KML with one vector layer
into XLSX is to write the geometry as WKT into a new text field. Check the
layer name with ogrinfo

ogrinfo jump_kml.kml
INFO: Open of `jump_kml.kml'
      using driver `LIBKML' successful.
1: Layer0

Now use ogrinfo with SQLite dialect

ogr2ogr -f xlsx -dialect sqlite -sql "select *, ST_AsText(geometry) as WKT
from layer0" jump_kml.xlsx jump_kml.kml

Check the result:

ogrinfo jump_kml.xlsx -al
.....
 tessellate (Integer) = -1
  extrude (Integer) = 0
  visibility (Integer) = -1
  WKT (String) = POLYGON Z((21.269511 47.7979 0, 21.345139 47.778019 0,
21.282376 47.733188 0, 21.269511 47.7979 0))

-Jukka Rahkonen-




Ravi Teja Krishna Wuyyuru wrote
> Hello GDAL team,
> 
>          We are trying to use ogr2ogr util for conversion of .kml to
> .xlsx. But the converted .xlsx file is missing geometry column. In
> documentation it says of using ogr vrt capabilities for this purpose but
> its not clear on procedure need to be followed. Can someone please direct
> us with solution to our problem?
> 
> Thanks in advance
> _______________________________________________
> gdal-dev mailing list

> gdal-dev at .osgeo

> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list