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.

I would like to export with ogr2ogr the data I have in a kml as ExtendedData

        <Placemark>
        <ExtendedData>
            <SchemaData schemaUrl="#15540_punti">
                <SimpleData name="myid">9</SimpleData>
                <SimpleData name="IDENTITA">15540_IX</SimpleData>
                <SimpleData name="NOME">Fontana</SimpleData>
                <SimpleData name="AMP_CONO_V">80</SimpleData>
                <SimpleData name="PROF_1SSP">5,2</SimpleData>
                <SimpleData name="PROF_1P">26</SimpleData>
                <SimpleData name="PROF_2P">78</SimpleData>
                <SimpleData name="PROF_3P">156</SimpleData>
                <SimpleData name="PROF_SFOND">245.26</SimpleData>
                <SimpleData name="ASSE_DIR">117g39p8s</SimpleData>
                <SimpleData name="UNITA PAES">Piazza Santa Croce</SimpleData>
                <SimpleData name="QUOTA_SLM">276 + 1.50</SimpleData>
            </SchemaData>
        </ExtendedData>
        <Point>
            <coordinates>11.26078815736627,43.76921971994336,0</coordinates>
        </Point>
    </Placemark>
    <Placemark>

I have tried with gdal 1.9.2 and libkml to export in CSV, but I obtain a file that does not contain the fields of the original kml (myid, IDENTITA, NOME, etc.). This is the output

Name,description,timestamp,begin,end,altitudeMode,tessellate,extrude,visibility
,,,,,,-1,-1,-1
,,,,,,-1,-1,-1
,,,,,,-1,-1,-1
,,,,,,-1,-1,-1
,,,,,,-1,-1,-1
,,,,,,-1,-1,-1

Is it possible with ogr2ogr to export KML ExtendedData in tabular form?

Thank you,

Andrea

share|improve this question
add comment

1 Answer 1

There are limitations in ogr2ogr, as created shp will will have just 2 extra fields: Name and Description.

So you can specify to just 2 features to be writen. For ex. it might work to specify to write down ur first tag 'SimpleData name="myid"' (though not sure..):

ogr2ogr -f KML output.kml input.shp -dsco NameField= SimpleData name="myid"

The following creation options are supported:

NameField: Allows you to specify the field to use for the KML element. Default value : 'Name' ogr2ogr -f KML output.kml input.shp -dsco NameField=RegionName

DescriptionField: Allows you to specify the field to use for the KML element. Default value : 'Description'

http://www.gdal.org/ogr/drv_kml.html

Well, other then that, you can script a bit with python and that could do ur task.. There are tools created like http://arcscripts.esri.com/details.asp?dbid=15603 but you should change the script in order to obtain data you want..

share|improve this answer
    
Ok, then ogr2ogr does not read ExtendedData fields as table fields. Thank you –  aborruso Apr 16 '13 at 12:46
add comment

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.