[gdal-dev] KML conversion and attributes

Favre, Sebastien Sebastien.Favre at spotimage.fr
Tue Mar 22 04:40:26 EDT 2011


Hello Brian,

Thank you for your response. I have correctly received your first email !
I have tried to remove <Folder> and </Folder> without success : the output Shapefile does not contain ScaleRank, FeatureCla, Name1 and Name2 attributes.
Did you manage to generate a Shapefile with the extra attributes ?

Sébastien

-----Message d'origine-----
De : gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] De la part de brian
Envoyé : lundi 21 mars 2011 18:41
À : Favre, Sebastien
Cc : gdal-dev at lists.osgeo.org
Objet : Re: [gdal-dev] KML conversion and attributes

Sbastien


try removeing the <Folder> and </Folder> from the kml

if you want seperate schemas for different layers you need seperate documents not seperate folders



Brian


rush at octopi ~ $ ogrinfo -al testy.kml
INFO: Open of `testy.kml'
      using driver `LIBKML' successful.

Layer name: testy
Geometry: Unknown (any)
Feature Count: 1
Extent: (103.620011, 51.460012) - (109.929807, 55.730914) Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        TOWGS84[0,0,0,0,0,0,0],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9108"]],
    AUTHORITY["EPSG","4326"]]
Name: String (0.0)
description: String (0.0)
timestamp: DateTime (0.0)
begin: DateTime (0.0)
end: DateTime (0.0)
altitudeMode: String (0.0)
tessellate: Integer (0.0)
extrude: Integer (0.0)
visibility: Integer (0.0)
Name: String (0.0)
Description: String (0.0)
ScaleRank: Integer (0.0)
FeatureCla: String (0.0)
Name1: String (0.0)
Name2: String (0.0)
OGRFeature(testy):1
  Name (String) = 0
  description (String) = Lake
  timestamp (DateTime) = (null)
  begin (DateTime) = (null)
  end (DateTime) = (null)
  altitudeMode (String) = (null)
  tessellate (Integer) = -1
  extrude (Integer) = -1
  visibility (Integer) = -1
  Name (String) = (null)
  Description (String) = (null)
  ScaleRank (Integer) = 0
  FeatureCla (String) = (null)
  Name1 (String) = 0
  Name2 (String) = POLYGON
  Style =
  POLYGON ((106.579985793079118 52.799981594445541,106.539988234485207
52.939998887740373,107.080006951935303
53.180010077519981,107.299993524201795
53.379997870489532,107.599975213656109
53.519989325568218,108.039948358189122
53.859968573616456,108.37997928266966
6 54.259995835987837,109.052703078245258
55.027597561251326,109.193469679808317
55.535602728896592,109.506990594523131
55.730913804743722,109.92980716353523
55.712956244522303,109.700002069133262
54.980003567110515,109.660004510539352 54.719993598033952,109.479963
820434477 54.339990953175658,109.319973586058836
53.819996853238692,109.220031366006367
53.619983222052994,108.999993117307554
53.780025132860928,108.600017531368451
53.439994208380398,108.800005324338002
53.379997870489532,108.760007765744092 53.200008856816936,1
08.459974399857487 53.140012518926071,108.179991489700114
52.799981594445541,107.79996300662566
52.579995022179034,107.319992303498765
52.420004787803393,106.64003380740229
52.320010891318617,106.100015089952194
52.039976304728967,105.740037062607001 51.7599933945
71595,105.240015903750844 51.520008043008133,104.819989862082508
51.460011705117267,104.300021600361674
51.500009263711178,103.760002882911607
51.600003160195953,103.620011427832907
51.73999461527464,103.859996779396369
51.85998729105637,104.399963820414143 51.859
98729105637,105.05997521364597 52.000004584351203,105.480001255314306
52.280013332724707,105.980022414170463
52.519998684288169,106.260005324327835
52.619992580772944,106.579985793079118 52.799981594445541))


On Mon, 2011-03-21 at 10:29 +0000, Favre, Sebastien wrote:
> 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></outerBoundaryIs></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.
> 
>  
> 
> Sbastien
> 
>  
> 
> 
> Ce courrier lectronique et toutes les pices ventuellement jointes qu'il contient sont CONFIDENTIELS et destins exclusivement  l'usage de leur destinataire. Si une erreur de transmission ou une adresse errone a mal dirige ce courrier, merci d'en informer l'expditeur en lui faisant une rponse par courrier lectronique ds rception. 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 rvler le contenu  une tierce partie.
> Ce courrier lectronique est  usage strictement informatif et ne saurait engager de quelque manire 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

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------

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