Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Here is the example kml file I am using:

<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
  <name>My Golf Course Example</name>
  <Placemark>
    <name>Club house3</name>
    <visibility>1</visibility>
    <phoneNumber>554545454</phoneNumber>
    <Point>
      <coordinates>-111.956,33.5043</coordinates>
    </Point>
  </Placemark>
</Document>
</kml>

I have named it input3.kml.

I put it, and ogr2ogr in the same folder, then I run this command:

ogr2ogr -f "ESRI Shapefile" output3.shp input3.kml

After that, I open up Quantum GIS and add vector layer, then add output3.shp.

Then I find the output3 layer, right click and open attribute table. How come only two attributes show up?(Name and Descriptio)

Reza

share|improve this question
    
You have name, visibility and phonenumber in the input. So what is inside the description field in your output? –  Uffe Kousgaard Feb 29 '12 at 6:51
    
There are only two fields when I view the resulting shapefile's attribute table, name and descripto. For name, it is as specified, for descripto, it is NULL –  Reza Hussain Feb 29 '12 at 19:15

1 Answer 1

I believe that the driver currently only works fully one way (i.e. writing TO kml). It currently expects a Description field in the KML data and uses that for its attribute, but truncates the name to 'Descriptio' because of the shapefile's DBF field naming limitation.

However, there is a version of the KML driver in development that will do what you want (so I guess it is not included in your version of ogr). BUT, you will need to re-format your KML using ExtendedData tags to wrap your... um... extended data.

share|improve this answer
1  
The LIBKML driver with ExtendedData handling is now incorporated in GDAL Version 1.9.2 onwards, OSGEO4W packages, MS4W and Qgis Master. –  Andre Joost Oct 18 '12 at 8:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.