Opened 12 years ago

Closed 12 years ago

#4536 closed defect (fixed)

gdal2tiles.py does not generate valid KML (OGC KML 2.2)

Reported by: tylere Owned by: hobu
Priority: normal Milestone: 1.10.0
Component: Utilities Version: svn-trunk
Severity: normal Keywords: gdal2tiles KML
Cc:

Description

The gdal2tiles.py script does not currently generate KML documents that are valid against the current OGC standard schema (http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd). In particular:

  • the default XML namespace is incorrect
  • the <name> element should not be capitalized
  • the <description> element should not be capitalized
  • within a <Region> element, the <LatLonAltBox> element should occur before the <Lod> element

A patch correcting these issues is attached.

Attachments (1)

gdal2tiles_valid_ogc_kml.patch (2.1 KB ) - added by tylere 12 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by tylere, 12 years ago

Note that Google Earth will silently accept many invalid KML files if the default settings are used. Select Tools->Options->General->KML Error Handling->"Show prompts for all error" to be notified of invalid KML.

comment:2 by Even Rouault, 12 years ago

Are you sure that the patch is correct as such ? I see you are inverting the order of some elements in the string, but you should also likely adapt the order of the values that will substitute the %d and similar stuff.

In particular, I believe that line 1631 should be changed like this ( argsminlodpixels moved after cwest) :

	""" % (cz, cx, cy, args['tileformat'], cnorth, csouth, ceast, cwest, args['minlodpixels'], url, cz, cx, cy)

comment:3 by tylere, 12 years ago

You are correct. Even though it is now creating valid KML, the element attributes are not correct (since I did not reorder the format string parameters). I will correct and add/replace the current patch.

by tylere, 12 years ago

comment:4 by Even Rouault, 12 years ago

Component: PythonBindingsUtilities
Milestone: 2.0.0
Resolution: fixed
Status: newclosed

Only reviewed the patch, but did not test myself.

r24047 /trunk/gdal/swig/python/scripts/gdal2tiles.py: gdal2tiles.py: make KML output conformant with KML 2.2 (patch by tylere, #4536)

Note: See TracTickets for help on using tickets.