I've done a good amount of debugging, and can confirm the following.

  • The KML file is being loaded from the same domain as the site.
  • The layer is getting added to the map and displayed in the layer switcher.
  • Using Firebug, I can see the generated layer markup, and it's properly being toggled to display or not display when using the layer switcher. The markup is below. I think the crux of the problem is the polyine is not being converted to anything renderable.
    <g id="OpenLayers.Layer.Vector_18_root" style="visibility: visible; display: block;" transform="">
      <g id="OpenLayers.Layer.Vector_18_vroot"/>
      <g id="OpenLayers.Layer.Vector_18_troot"/>
    </g>
    

    Thoughts?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

levelos’s picture

Title: KML with polylines not visible on the map » KML layers not visible on the map

I take it back, no type of KML overlay is visible, be it a point, linestring, or polygon.

tmcw’s picture

Is there a live example of this happening?

levelos’s picture

I'm working in a development environment, so can't point to my specific tests. I've tried using both 6.x-2.0-alpha8 and the latest dev snapshot, and I've tried using several sample KML files, including the one on the Ol site, http://openlayers.org/dev/examples. Is there an example where KML layers are working? Maybe I could cross reference.

levelos’s picture

Important update on this one. The KML layers work correctly when the map projection is set to 4326, but not 900913. Obviously poses a problem when wanting to use Google. Any thoughts?

levelos’s picture

Status: Active » Needs review
FileSize
318 bytes

Ok, more updates. Sorry for the live stream of my debugging.

Seems the features in the KML files were being rendered on the map, just at the wrong coordinates, all with 0,0, at least when the map projection was set to 900913. When the projection was changed 4326, everything worked fine. A bit more digging led me to the solution, including the projection setting in the KML vector layer definition in kml.js. A patch is attached.

Status: Needs review » Needs work

The last submitted patch, openlayers-kml-projection.patch, failed testing.

levelos’s picture

Trying a new patch, the last one was rejected.

tmcw’s picture

FileSize
1.47 KB

Can you test this patch and confirm that it works for you? This should provide a more comprehensive fix for the problem.

levelos’s picture

Thanks, that seems to work as well.

tmcw’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.