Status

Location
London, England
Subscribe to GeoRSS Subscribe to KML


A Proposal - GeoRSS & KML

Published in Geo, GeoRSS, KML  |  7 Comments


There has recently been a lot of discussion around KML becoming part of the OGC and the future of GeoRSS and KML. Will GeoRSS use KML payloads, or vice versa? Will one just subsume the other? After speaking with a bunch of people at Where, and also thinking about various announcements and talks given by Google-ites, Geo-ers, and standards makers, I’m proposing the following practice for using GeoRSS and KML together along with other formats.

In the talk announcing KML submission to OGC, the phrase “KML is HTML for the geospatial web” was used. I think this is a perfectly apt analogy. To complete the analogy, (taking you back to your SAT days)

HTML : RSS :: KML : GeoRSS

The purpose of the following examples is to illustrate the use of GeoRSS to syndicate KML content, similar to RSS support in HTML. GeoRSS merely adds a geographic component to the common RSS that syndicates web content. KML similarly offers a geospatial alternative representation of HTML content.

Syndication

Therefore, as appropriate, GeoRSS should be used based on existing usages of RSS. This means providing a rel=”alternate” link in both HTML and KML files. Conversely, an Atom or RSS feed requires use of a ‘link’ element to reference the originating content of the syndication. A rel=”alternate” can then be used in a GeoRSS feed to reference the KML version of that content.

Within a GeoRSS file, the entire feed, or channel, can link to the content in type=”text/html” and type=”application/vnd.google-earth.kml+xml”. Within a single entry, the GeoRSS feed can then link to the specific anchor, or element, within the original HTML or KML content using an anchor in the href.

kml_georss.rss

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>KML GeoRSS Example</title>
  <link href="http://example.org/"/>
  <updated>2007-06-04T12:34:02Z</updated>
  <author>
    <name>Andrew Turner</name>
  </author>
  <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
  <link rel="alternate" type="test/html"
    href="http://example.org/"/>
  <link rel="alternate" type="application/vnd.google-earth.kml+xml"
    href="http://example.org/kml_georss.kml"/>

  <entry>
    <title>This is my first article</title>
    <link href="http://example.org/2007/06/04/article"/>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <updated>2003-12-13T18:30:02Z</updated>
    <summary>
      KML is the HTML of the geospatial web, used to visualize content, and GeoRSS is the syndication of that content. 

      While you're here, make sure to check out my <a href="http://example.org/myspots.kml#favoritepark" type="application/vnd.google-earth.kml+xml kml">favorite park</a>.
    </summary>
    <link rel="alternate" type="application/vnd.google-earth.kml+xml"
     href="http://example.org/kml_georss.kml#article1"/>
  </entry>
</feed>

Documentation

Within an HTML file, the <head> element can contain alternate links to the KML representation as well as the GeoRSS syndication. Similarly, KML 2.2 can contain an <atom:link> alternate representation back to the original HTML content and GeoRSS syndication of the geospatial information. By using these links, a resource can offer multiple formats as appropriate, syndication for alerting users of updates to the content, or visualization for a richer geospatial view.

For a specific KML Placemark, an <atom:link> can be used to link to the original HTML element using the anchor support in the href. Conversely, the HTML element, similar to a GeoRSS item, can use an <a> element to link to the specific KML Placemark representation. This similarly allows for the documentation element to reference the richer visualization of the feature. Clicking this link would either launch a KML viewer, or the original HTML renderer could render the KML element inline, within the browser.

kml_georss.html

<html>
<head>
  <title>KML GeoRSS Example</title>
  <link rel="alternate" type="application/rss+xml"
    href="http://example.org/kml_georss.rss" title="GeoRSS feed for My Page">
  <link rel="alternate" type="application/vnd.google-earth.kml+xml"
    href="http://example.org/kml_georss.kml"/>
</head>

<body id="kml_georss">
    <h1>Example of KML, GeoRSS, and HTML being used together</h1>

    <h2 id="article1">This is my first article</h2>
    <p>KML is the HTML of the geospatial web, used to visualize content, and GeoRSS is the syndication of that content. 

      While you're here, make sure to check out my <a href="http://example.org/myspots.kml#favoritepark"    type="application/vnd.google-earth.kml+xml">favorite park</a>.
    </p>

</body>
</html>

Notice that by using the type attribute in the <a> we can link to other KML elements, similar to an HTML document linking to elements in other HTML documents.

Visualization

kml_georss.kml

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
  <name>kml_georss.kml</name>
  <atom:link type="text/html"
    href="http://example.com" title="My Page"></atom:link>
  <atom:link rel="alternate" type="application/rss+xml"
    href="http://example.com/kml_georss.rss" title="GeoRSS feed for My Page"></atom:link>
  <Placemark id="article1">
    <name>This is my first article</name>
    <atom:author>
      <atom:name>Andrew Turner</atom:name>
    </atom:author>
    <atom:link href="http://example.org/kml_georss.html#article1"></atom:link>
    <description>
      KML is the HTML of the geospatial web, used to visualize content, and GeoRSS is the syndication of that content. 

      While you're here, make sure to check out my <a href="http://example.org/myspots.kml#favoritepark" type="application/vnd.google-earth.kml+xml">favorite park</a>.
    </description>
    <Point>
      <coordinates>-122.370533,37.823842,0</coordinates>
    </Point>
  </Placemark>
</Document>
</kml>

Together, these suggestions allow for parallel use of KML and HTML for content, and GeoRSS for syndication (notification of updates) to that content. It keeps the GeoRSS as a pure markup of the new information, and keeps styling information in HTML and KML.

Here is a spiffy diagram to help illustrate linking the documents and articles together:

GeoRSS, KML, HTML interoperability

A last consideration about linking HTML content and KML content. Both formats are merely markups for storing and rendering information and not bound to a specific renderer (e.g. Firefox or GoogleEarth). However, it is still beneficial to link to a richer geospatial markup from an HTML file. <a> elements can optionally utilize the type attribute to specify the link follows to a KML file. It should explicitly noted that opening a link to a KML type should not necessarily open in GoogleEarth. Again, KML is just a richer geospatial markup of information.

For example, if a user is viewing a location from a GeoRSS file loaded in a 2D map representation, and link in the content points to a KML type, clicking this link should first open the location in the same 2D map representation. If the link is clicked in an HTML file, the appropriate MIME-type handler should be invoked. This is similar to a user clicking a link in an HTML document and opening the link in the HTML renderer.

Depending on the 2D map rendered, an optional “view in 3D” link could be offered to open the Placemark in GoogleEarth or other KML renderer.

OpenSearch

This proposal is just a suggestion, and doesn’t require a change to any of the included formats. In fact, it is just a recommendation for a common usage of these formats to provide for better user experience and linking together your content. Additionally, my previous discussion on OpenSearch Geo fits perfectly with this as you can specify search mechanism for the same content-types. So if you just want the recent changes, request the RSS. Then you could use those results (page) to query specific KML rich placemarks for visualizing.

Similar Posts


Responses

  1. Ron says:

    June 25th, 2007 at 7:52 am (#)

    I’ve been wondering about this topic. Does your proposal “work” already? I can see that it works as far as cross-referencing the various formats, and putting appropriate content in each, but do the various renderers support it yet, or is that what you’re proposing here?

    Ron

  2. Andrew says:

    June 25th, 2007 at 11:24 am (#)

    @Ron - most of what I’m proposing works right now. However, the KML is using the 2.2 spec, which is a proposed - but unimplemented yet - spec. Hopefully this will be implemented and released soon in renderers. But even so, you can still use the format I’m proposing, you just won’t see all the benefits yet.

  3. GeoRSS Weblog » Blog Archive » Michael Jones on GeoRSS says:

    August 3rd, 2007 at 2:35 am (#)

    [...] Andrew has some thoughts on how GeoRSS and KML could work together. He simply sums it up as HTML : RSS :: KML : GeoRSS, which seems like a useful departure point for discussion. Posted by mikel Filed in General [...]

  4. Blog Mann » Michael Jones on GeoRSS says:

    August 3rd, 2007 at 4:49 am (#)

    [...] Andrew has some thoughts on how GeoRSS and KML could work together. He simply sums it up as HTML : RSS :: KML : GeoRSS, which seems like a useful departure point for discussion. [...]

  5. High Earth Orbit » Blog Archive » KML 3 Kick-off, Module: Core says:

    August 3rd, 2007 at 12:57 pm (#)

    [...] This list was derived from the current KML 2.1 tags and signifies the general concepts we’re hoping to have in KML Core - allow a user to express location, time, and possibly link to another KML document or service. In addition, providing the current Atom support allows for attribution and other interesting things for linking to HTML and GeoRSS. [...]

  6. mapufacture blog » KML Update and Clarification of OWS directive says:

    August 28th, 2007 at 1:42 pm (#)

    [...] Other goals that have been discussed, but just haven’t been blogged (or documented) include: KML as Context document, KML and GeoRSS interoperability - though I blogged about it previously and have heard general acceptance of the ideas, Sensor streaming, and styling imported geometry. [...]

  7. Geotag Icon :: High Earth Orbit says:

    April 4th, 2008 at 5:50 pm (#)

    [...] of them that meant something slightly different. And KML is a visualization format, similar to HTML + CSS. GPX is a very specific format that works for handheld GPS units and PND’s. I’m [...]

Leave a Response