[gdal-dev] KML conversion and attributes

Favre, Sebastien Sebastien.Favre at spotimage.fr
Mon Mar 21 12:11:36 EDT 2011


Hello Stefan,

Yes I checked that page and notice there were limitations specifically on attributes conversion.
This is why I looked at : http://www.gdal.org/ogr/drv_libkml.html thinking attributes handling would be better.
I have managed to install the driver but conversion are not better.
I have certainly missed something...

Sébastien

-----Message d'origine-----
De : Stefan Keller [mailto:sfkeller at gmail.com] 
Envoyé : lundi 21 mars 2011 15:12
À : Favre, Sebastien
Cc : gdal-dev at lists.osgeo.org
Objet : Re: [gdal-dev] KML conversion and attributes

Did you check the doc. at http://www.gdal.org/ogr/drv_kml.html ?

Yours, S.

2011/3/21 Favre, Sebastien <Sebastien.Favre at spotimage.fr>:
> Hello to all,
>
>
>
> I try to convert the following KML file into Shapefile format.
>
>
>
> <?xml version="1.0" encoding="utf-8" ?>
>
> <kml xmlns="http://www.opengis.net/kml/2.2">
>
> <Document><Folder><name>110m_lakes</name>
>
> <Schema name="110m_lakes" id="110m_lakes">
>
>                 <SimpleField name="Name" type="string"></SimpleField>
>
>                 <SimpleField name="Description" 
> type="string"></SimpleField>
>
>                 <SimpleField name="ScaleRank" 
> type="int"></SimpleField>
>
>                 <SimpleField name="FeatureCla" 
> type="string"></SimpleField>
>
>                 <SimpleField name="Name1" type="string"></SimpleField>
>
>                 <SimpleField name="Name2" type="string"></SimpleField>
>
> </Schema>
>
>   <Placemark>
>
>                 <name>0</name>
>
>                 <description>Lake</description>
>
>   <Style><LineStyle><color>ff0000ff</color></LineStyle>
> <PolyStyle><fill>0</fill></PolyStyle></Style>
>
>                 <ExtendedData><SchemaData schemaUrl="#110m_lakes">
>
>                                <SimpleData name="Name">0</SimpleData>
>
>                                <SimpleData 
> name="Description">Lake</SimpleData>
>
>                                <SimpleData name="ScaleRank">Lake 
> Baikal</SimpleData>
>
>                                <SimpleData name="Name1">0</SimpleData>
>
>                                <SimpleData 
> name="Name2">POLYGON</SimpleData>
>
>                 </SchemaData></ExtendedData>
>
>
> <Polygon><outerBoundaryIs><LinearRing><coordinates>106.57998579307912,
> 52.799981594445541
> 106.53998823448521,52.939998887740373 
> 107.0800069519353,53.180010077519981
> 107.2999935242018,53.379997870489532 
> 107.59997521365611,53.519989325568218
> 108.03994835818912,53.859968573616456 
> 108.37997928266967,54.259995835987837
> 109.05270307824526,55.027597561251326 
> 109.19346967980832,55.535602728896592
> 109.50699059452313,55.730913804743722 
> 109.92980716353523,55.712956244522303
> 109.70000206913326,54.980003567110515 
> 109.66000451053935,54.719993598033952
> 109.47996382043448,54.339990953175658 
> 109.31997358605884,53.819996853238692
> 109.22003136600637,53.619983222052994 
> 108.99999311730755,53.780025132860928
> 108.60001753136845,53.439994208380398 
> 108.800005324338,53.379997870489532
> 108.76000776574409,53.200008856816936 
> 108.45997439985749,53.140012518926071
> 108.17999148970011,52.799981594445541 
> 107.79996300662566,52.579995022179034
> 107.31999230349876,52.420004787803393 
> 106.64003380740229,52.320010891318617
> 106.10001508995219,52.039976304728967 
> 105.740037062607,51.759993394571595
> 105.24001590375084,51.520008043008133 
> 104.81998986208251,51.460011705117267
> 104.30002160036167,51.500009263711178 
> 103.76000288291161,51.600003160195953
> 103.62001142783291,51.73999461527464 
> 103.85999677939637,51.85998729105637
> 104.39996382041414,51.85998729105637 
> 105.05997521364597,52.000004584351203
> 105.48000125531431,52.280013332724707 
> 105.98002241417046,52.519998684288169
> 106.26000532432784,52.619992580772944
> 106.57998579307912,52.799981594445541</coordinates></LinearRing></oute
> rBoundaryIs></Polygon>
>
>   </Placemark>
>
> </Folder></Document></kml>
>
>
>
> I use the command line for that : ogr2ogr -f "ESRI Shapefile" lake.shp 
> lake.kml
>
> The problem is I only get the attributes Name and Descriptio (after 
> trunk) in the output Shapefile.
>
> Attributes ScaleRank, Name12 and Name2 are missing.
>
> Do you have any explanation ?
>
>
>
> Please note,  I have installed the LIBKML driver In GDAL/OGR (thanks 
> to Frank for its help) :
>
>
>
> D:\Data\ >ogr2ogr --formats
>
> Supported Formats:
>
>   -> "ESRI Shapefile" (read/write)
>
>   -> "MapInfo File" (read/write)
>
>   -> "UK .NTF" (readonly)
>
>   -> "SDTS" (readonly)
>
>   -> "TIGER" (read/write)
>
>   -> "S57" (read/write)
>
>   -> "DGN" (read/write)
>
>   -> "VRT" (readonly)
>
>   -> "REC" (readonly)
>
>   -> "Memory" (read/write)
>
>   -> "BNA" (read/write)
>
>   -> "CSV" (read/write)
>
>   -> "GML" (read/write)
>
>   -> "GPX" (read/write)
>
>   -> "LIBKML" (read/write)
>
>   -> "KML" (read/write)
>
>   -> "GeoJSON" (read/write)
>
>   -> "GMT" (read/write)
>
>   -> "ODBC" (read/write)
>
>   -> "PGeo" (readonly)
>
>   -> "MSSQLSpatial" (read/write)
>
>   -> "PCIDSK" (read/write)
>
>   -> "XPlane" (readonly)
>
>   -> "AVCBin" (readonly)
>
>   -> "AVCE00" (readonly)
>
>   -> "DXF" (read/write)
>
>   -> "Geoconcept" (read/write)
>
>   -> "GeoRSS" (read/write)
>
>   -> "GPSTrackMaker" (read/write)
>
>   -> "VFK" (readonly)
>
>   -> "PGDump" (read/write)
>
>   -> "GPSBabel" (read/write)
>
>   -> "SUA" (readonly)
>
>   -> "OpenAir" (readonly)
>
>   -> "PDS" (readonly)
>
>   -> "HTF" (readonly)
>
>   -> "AeronavFAA" (readonly)
>
>
>
> Thanks in advance for your help.
>
>
>
> Sébastien
>
>
>
> Ce courrier électronique et toutes les pièces éventuellement jointes 
> qu’il contient sont CONFIDENTIELS et destinés exclusivement à l’usage 
> de leur destinataire. Si une erreur de transmission ou une adresse 
> erronée a mal dirigée ce courrier, merci d’en informer l’expéditeur en 
> lui faisant une réponse par courrier électronique dès réception. Si 
> vous n’êtes pas le destinataire de ce courrier, vous ne devez pas 
> l’utiliser, le conserver, en faire état, le distribuer, le copier, 
> l’imprimer ou en révéler le contenu à une tierce partie.
> Ce courrier électronique est à usage strictement informatif et ne 
> saurait engager de quelque manière que ce soit SPOT IMAGE SA, ni ses filiales.
>
> This e-mail and any attachments hereto are CONFIDENTIAL and intended 
> solely for the use of the addressee. If you have received this e-mail 
> in error please send it back to the person that sent it to you.
> If you have received it in error, please notify the sender by return email.
> If you are not the addressee of this email, you must not use, keep, 
> disseminate, copy, print or otherwise deal with it.
> This email is for information only and will not bind SPOT IMAGE SA in 
> any contract or obligation, nor its subsidiaries.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


Ce courrier électronique et toutes les pièces éventuellement jointes qu’il contient sont CONFIDENTIELS et destinés exclusivement à l’usage de leur destinataire. Si une erreur de transmission ou une adresse erronée a mal dirigée ce courrier, merci d’en informer l’expéditeur en lui faisant une réponse par courrier électronique dès réception. Si vous n’êtes pas le destinataire de ce courrier, vous ne devez pas l’utiliser, le conserver, en faire état, le distribuer, le copier, l’imprimer ou en révéler le contenu à une tierce partie.
Ce courrier électronique est à usage strictement informatif et ne saurait engager de quelque manière que ce soit SPOT IMAGE SA, ni ses filiales.

This e-mail and any attachments hereto are CONFIDENTIAL and intended solely for the use of the addressee. If you have received this e-mail in error please send it back to the person that sent it to you.
If you have received it in error, please notify the sender by return email. If you are not the addressee of this email, you must not use, keep, disseminate, copy, print or otherwise deal with it.
This email is for information only and will not bind SPOT IMAGE SA in any contract or obligation, nor its subsidiaries.


More information about the gdal-dev mailing list