Tuesday 28 February 2017

QGIS Not Importing ExtendedData from Self-Exported KML?


I've been scouring the internet for the past few hours, and I just can't seem to figure it out!


I am using QGIS 2.4.0-Chugiak.



Here are my simple steps:


1) I create a new ShapeFile (Type: Polygon) and add 3 attributes: enter image description here


2) I draw a simple polygon with 6 coordinate points and give it the following attributes: enter image description here


3) I now export the Shapefile as a KML and it gives me the following text code:


    








test1



test1
9
Miami


relativeToGroundrelativeToGround-73.977273863779757,40.764000085624744 -73.976720692372155,40.764083880580976 -73.976333472386827,40.763925601130516 -73.976480984762205,40.763781287185402 -73.976837473002647,40.763613696404278 -73.977390644410249,40.763674215346221 -73.977273863779757,40.764000085624744




4) Finally I go ahead and re-import what I just exported, using "Add Vector Layer" hoping to get all the attributes back, but I get none of them!


enter image description here


I just want to get all the attributes imported.


What am I doing wrong?



Answer




This seems to be a long running bug in QGIS: How to convert KML to shapefile without losing attributes using QGIS?


I am pretty sure it worked some time, but QGIS 1.8 and 2.2 show the same behaviour you mention.


Add vector Layer is using OGR/GDAL in the background, and that has two drivers for kml reading (KML and LIBKML), but LIBKML is not included in OSGEO4W builds.


On the other side, ogr2ogr from gisinternals/sdk is able to read the kml file, and convert it into a valid shapefile with all attributes. They have added the LIBKML driver. The same applies for the ubuntugis unstable QGIS 2.4.0 version on Ubuntu 14.04.


There are some bug report for it: http://hub.qgis.org/issues/8273 and http://trac.osgeo.org/osgeo4w/ticket/291


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...