I have noticed of late a number of requests on the Google Community site for 1) an XML Schema for KML and 2) Some attempt at converging KML with GML. To help this process along I thought would post some observations on the GML/KML overlap.
GML is intended to describe geographic objects. It uses application schemas written in XML Schema for this purpose. It is NOT intended for graphical display. It leaves this to other grammars like SVG.
KML is one tool fits all. It defines geographic objects and their styling and their graphical representation. It uses schemas as part of the object description component, but uses its own schema language.
Since KML and GML serve different purposes they can only really be compared on their ability to describe geographic objects.
KML provides a basic geometric objects including Point, LineString, Polygon. Its geometry model is identical to GML v1.0 and 2.0. Note that GML 3.0 is an extended version of the GML 2. geometry model. Here is a comparison for a Polygon in KML and GML.
KML Polygon: (from the KML Reference http://www.keyhole.com/kml/kml_doc.html )
In GML this would look like:
Note that these are identical. I could have surpressed the gml: in these examples as everything is in the same namespace. So far KML seems to be ignorant of namespaces.
If you look at all of KML, you will see that a fair number of tags are "borrowed" from GML. The table of contents for the KML list of elements looks like this:
- <coordinates> (GML)
- <description> (GML)
- <GeometryCollection> (GML)
- <innerBoundaryIs> (GML)
- <LinearRing> (GML)
- <LineString> (GML)
- <outerBoundaryIs> (GML)
- <Point> (GML)
- <Polygon> (GML)
- <TimePeriod> (GML)
- <TimeInstant> (GML)
- <timePosition> (GML)
I have annotated the elements which are copied from GML using (GML). Styling from GML should thus be pretty easy.