[OpenLayers-Users] GML/KML feeds not loading

Michael Angstadt mangstadt at jbisoft.com
Mon Dec 29 12:06:38 EST 2008


Good afternoon,

I'm having trouble getting certain KML and GML feeds to load in 
OpenLayers and I wonder if someone can help.  The issue appears in 
versions 2.6 and 2.7 of OpenLayers.

Let me start with KML feeds.  The feed taken from the "KML Layer 
Example" on the examples section of the OpenLayers website[1] works just 
fine.  This feed draws a number of weird shapes in Arizona.  However, I 
cannot get another feed, taken from CBSNews' website, to work[2].  One 
of my co-workers was able to view this in Google Earth just fine (see 
attached screenshot).  Is this feed only compatible with Google Earth?  
I searched the bug tracking system and found a ticket that might be 
relevant[3].  The ticket states that "the current KML class is a Format 
& hence can only deal in Feature.Vector objects".  This seems to explain 
why the feed which displays vectors[1] works and the feed which displays 
points[2] does not.

So unless my Javascript code is incorrect, it seems like OpenLayers only 
has *partial* support for KML feeds.  Is this true?  Is there any reason 
why the CBSNews feed should not work in OpenLayers?  Here is the 
Javascript code I use to load the KML layer:

map.addLayer(new OpenLayers.Layer.GML(
'CBSNews',
'http://www.cbsnews.com/common/includes/google/cbsnews.kml',
{
  format: OpenLayers.Format.KML,
  formatOptions:
  {
    extractStyles: true,
    extractAttributes: true,
    maxDepth: 3
  }
}
));

I have the identical issue with GML feeds.  Example feeds taken from the 
OpenLayers website[4,5] work fine (they draw shapes in France and Canada 
respectively).  But a GML feed a co-worker of mine found online[6] does 
not.  This co-worker has told me that the feed displays fine in Google 
Earth and shows a number of points across the US (I don't have a 
screenshot for this unfortunately).

So, is it also true that OpenLayers only has *partial* support for GML 
feeds?  Here is my Javascript code for loading a GML layer:

map.addLayer(new OpenLayers.Layer.GML('airports', 
'http://examples.oreilly.com/webmapping/ch7/airports.gml'));

Thanks for your help and have a Happy New Year!

-Mike

[1] http://openlayers.org/dev/examples/kml/lines.kml
[2] http://www.cbsnews.com/common/includes/google/cbsnews.kml
[3] http://trac.openlayers.org/ticket/1567
[4] http://openlayers.org/dev/examples/gml/polygon.xml
[5] http://openlayers.org/dev/examples/gml/owls.xml
[6] http://examples.oreilly.com/webmapping/ch7/airports.gml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: google_earth.jpg
Type: image/jpeg
Size: 146908 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081229/86ed2830/google_earth.jpg


More information about the Users mailing list