[gdal-dev] Regarding Attribute corruption while reading KML file

Even Rouault even.rouault at mines-paris.org
Mon Oct 1 14:03:26 PDT 2012


Le lundi 01 octobre 2012 22:37:48, Abhinav a écrit :
> I am having Issue in reading attributes of kml file with Gdal.
> When I am running gdalinfo in windows, it displays
> 
> Had to open data source read-only.
> INFO: Open of `D:\Users\DMS\Desktop\Airbase.kml'
>       using driver `KML' successful.
> 1: AIR_FIELD (3D Point)
> 
> Is it the right driver for the windows?

Extended schema is only support by the LIBKML driver ( see 
http://gdal.org/ogr/drv_libkml.html ), but it is likely not included in your 
GDAL binary distribution, otherwise the file would have been opened by it.

Anyway, in my own GDAL build that includes the LIBKML driver, I don't manage 
to get the extended attributes. The reason is that this file is not a valid KML 
2.2 file (in the sense, it doesn't validate against the OGC KML 2.2 schema at 
http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd ). The issue is that the 
<Schema> ... </Schema> declaration is inside the <Folder> element, instead of 
being right under the <Document> element.

Once this is corrected in a text editor, the LIBKML driver can read the 
attributes :

$ ogrinfo Airbase.kml  -al
INFO: Open of `Airbase.kml'
      using driver `LIBKML' successful.

Layer name: AIR_FIELD
Geometry: Unknown (any)
Feature Count: 1
Extent: (82.686300, 22.204900) - (82.686300, 22.204900)
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)
drawOrder: Integer (0.0)
icon: String (0.0)
Name: String (0.0)
Description: String (0.0)
NAME: String (0.0)
Affiliation: Integer (0.0)
Plan: Integer (0.0)
ColorR: Integer (0.0)
ColorG: Integer (0.0)
ColorB: Integer (0.0)
ColorA: Integer (0.0)
LineWidth: Integer (0.0)
IconSize: Real (0.0)
AutoSwitch: Real (0.0)
Representation: Integer (0.0)
RotationX: Real (0.0)
RotationY: Real (0.0)
RotationZ: Real (0.0)
ScaleX: Real (0.0)
ScaleY: Real (0.0)
ScaleZ: Real (0.0)
AAS_CODE: Integer (0.0)
AFDALTITUDE_IN_M: Real (0.0)
AFD_ACTYPE: String (0.0)
AFD_ADINFO: String (0.0)
AFD_ID: String (0.0)
AFD_NAME: String (0.0)
AFD_SECTOR: String (0.0)
AFD_TYPE: String (0.0)
AF_UNIT: String (0.0)
ASSOCIATEDWITH: String (0.0)
CONTROL_TOWER: Integer (0.0)
DATE_TIME: String (0.0)
DP_DAY_NI: String (0.0)
FORFMNUNIT: String (0.0)
HANGER_CAPACITY: Integer (0.0)
KEYID: Integer (0.0)
LOC_CONT_TOWER: String (0.0)
LOC_FUEL_TKS: String (0.0)
LOC_LAT: String (0.0)
LOC_LONG: String (0.0)
LOC_RDR_STN: String (0.0)
NO_OF_RUNWAYS: Integer (0.0)
PHOTOGRAPHS: String (0.0)
REFUEL_CAPACITY: Real (0.0)
RW_BEARING: String (0.0)
RW_LENGTH_IN_M: Real (0.0)
RW_SURFACE: String (0.0)
RW_WIDTH_IN_M: Real (0.0)
VA_VP_INFO: String (0.0)
OGRFeature(AIR_FIELD):1
  Name (String) = A2
  description (String) = (null)
  timestamp (DateTime) = (null)
  begin (DateTime) = (null)
  end (DateTime) = (null)
  altitudeMode (String) = (null)
  tessellate (Integer) = -1
  extrude (Integer) = -1
  visibility (Integer) = -1
  drawOrder (Integer) = (null)
  icon (String) = (null)
  Name (String) = (null)
  Description (String) = (null)
  NAME (String) = (null)
  Affiliation (Integer) = 1
  Plan (Integer) = 1
  ColorR (Integer) = 255
  ColorG (Integer) = 0
  ColorB (Integer) = 0
  ColorA (Integer) = 255
  LineWidth (Integer) = 11
  IconSize (Real) = 12
  AutoSwitch (Real) = 51
  Representation (Integer) = 5
  RotationX (Real) = 13
  RotationY (Real) = 14
  RotationZ (Real) = 15
  ScaleX (Real) = 16
  ScaleY (Real) = 17
  ScaleZ (Real) = 19
  AAS_CODE (Integer) = 1
  AFDALTITUDE_IN_M (Real) = 2
  AFD_ACTYPE (String) = 3
  AFD_ADINFO (String) = 4
  AFD_ID (String) = 5
  AFD_NAME (String) = 6
  AFD_SECTOR (String) = 7
  AFD_TYPE (String) = 8
  AF_UNIT (String) = 9
  ASSOCIATEDWITH (String) = 10
  CONTROL_TOWER (Integer) = 11
  DATE_TIME (String) = 12
  DP_DAY_NI (String) = 13
  FORFMNUNIT (String) = 14
  HANGER_CAPACITY (Integer) = 15
  KEYID (Integer) = 16
  LOC_CONT_TOWER (String) = 17
  LOC_FUEL_TKS (String) = 18
  LOC_LAT (String) = 19
  LOC_LONG (String) = 20
  LOC_RDR_STN (String) = 21
  NO_OF_RUNWAYS (Integer) = 22
  PHOTOGRAPHS (String) = 23
  REFUEL_CAPACITY (Real) = 24
  RW_BEARING (String) = 25
  RW_LENGTH_IN_M (Real) = 26
  RW_SURFACE (String) = 27
  RW_WIDTH_IN_M (Real) = 28
  VA_VP_INFO (String) = 29
  POINT (82.6863 22.2049 0)


More information about the gdal-dev mailing list