[OpenLayers-Users] KML icons

Egil Möller egil at skytruth.org
Tue Feb 12 05:30:13 PST 2013


Hi!

I'm trying to load KML into a vector layer. The KML contains styles with
relative paths to icons:

            <IconStyle>
                <color>ff0099ff</color>
                <scale>0.5</scale>
                <heading>496.77</heading>
                <Icon>
                    <href>files/vd.png</href>
                </Icon>
            </IconStyle>

This results in a 404 on http://myserver.com/files/vd.png (the kml file
is not located in the root of my server...). I've tried to solve this
using new

                OpenLayers.Format.KML({
                  styleBaseUrl: "http://myserver.com/static/kml-files",
                  extractStyles: true,
                  extractAttributes: true,
                  maxDepth: 2
                })

That makes any errors go away, but no icon markers show up, and when I
check the network tab in the chrome debugger I don't see vd.png loaded
at all.

I actually don't get any errors regardless of what I set styleBaseUrl
to, as long as it is set.

Any ideas,
Egil


More information about the Users mailing list