[OpenLayers-Users] GML/KML feeds not loading
mangstadt at jbisoft.com
Tue Dec 30 10:33:46 EST 2008
The CBSNews feed does contain a city and state/country, but actually
parsing this data, getting Google to geocode it, and plotting it on the
OpenLayers map would take more effort than we're willing to
expend...unless this is common with KML files, which doesn't seem to be
Brad Spencer wrote:
> You can call Google's geocoding engine as a web service to geocode addresses
> on the fly. I think there may be some limits on large batch numbers and of
> course there is that licensing/copyright issue with Google.
> The result is a XML file containing an errorCode, accuracyIndicator, lat,
> Maybe this can help you for part of your problem.
> Cheers, Brad....
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
> Behalf Of Christopher Schmidt
> Sent: Tuesday, December 30, 2008 4:35 AM
> To: Michael Angstadt
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] GML/KML feeds not loading
> On Mon, Dec 29, 2008 at 12:06:38PM -0500, Michael Angstadt wrote:
>> 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 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. 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. 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 works and the feed which displays
>> points does not.
> Points are vectors; images are not. The problems you're running into are
> probably three-fold:
> 1. You're probably violating the same origin policy.
> (Unless your HTML page is hosted on cbsnews.com, which is possible,
> but seems unlikely.)
> 2. You're attempting to load a NetworkLink. OpenLayers 2.7 does not
> support NetworkLinks, which was recently fixed in SVN. You can set
> your KML file to maxDepth: 2 or some such, and it will parse the
> networklink in the file you have but...
> 3. It appears that the linked file actually doesn't contain any
> geographic information. Instead, it contains just addresses...
> which, I guess, Google Earth looks up, but OpenLayers can't. I can
> imagine ways to deal with this, but my first one would be to
> complain to CBS that the KML that they're providing is useless to
> any non-Google Earth client.
> Additionally, Google Maps seems to think that the file is invalid.
> Who am I to complain when Google says it's wrong?
>> 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
> Quite simply, the CBS news feed doesn't contain any locations, only
> addresses, so you need a full gazetteer for it to work. Calling this KML
> at all is simply more evidence that the KML spec is hopelessly
> overbroad, and since not even Google will read it, I have no qualms
> saying that OpenLayers won't.
>> map.addLayer(new OpenLayers.Layer.GML(
>> format: OpenLayers.Format.KML,
>> 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 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).
> I don't understand how this is possible, since the GML file has no
> projection data with it, and the file is in projected coordinates.
> Assuming you knew which coordinate reference system this was in, you
> could probably use it with OpenLayers, either by reprojecting it first
> or by using built in reprojection support, but without the actual
> SRS/CRS information, there's no way to know how to project it.
> Now, the GML file includes lat/long coordinates as feature attributes,
> so you could write a tool which would convert this GML, and perhaps that
> is something that some pro version of Google Earth suppots, but Google
> Earth won't even let me open this file, so I don't know what he's
>> So, is it also true that OpenLayers only has *partial* support for GML
> No; we have full support for GML2, and this file parses correctly... but
> all its points end up off the upper right corner of the map, since
> they're coordinates like:
> Which isn't anywhere I know how to find.
More information about the Users