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 Description)
Best Answer
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.