Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm loading 3 KMLs using an ashx handler taken from http://code.google.com/p/iisproxy. The 3 KMLs I'm trying to load are Openlayers sundials ( http://openlayers.org/dev/examples/kml/sundials.kml ), Marine Traffic KML ( http://www.marinetraffic.com/ais/ge_marinetraffic.kml ), and flightwise ( http://mw1.google.com/mw-earth-vectordb/flightwise/flightwise_root.kml ).

The Sundial is working for me, but the other 2 don't. I'm afraid the problem is because the other 2 KMLs have file links inside while sundials KML has data only.

Is there a way I can make the other two work on my IIS?

This is the code I used:

<!-- language: lang-js -->

function init() {

    var map = new OpenLayers.Map("map");
    OpenLayers.ProxyHost = "/proxy.ashx?url=";

    var osm = new OpenLayers.Layer.OSM();

    var flight = new OpenLayers.Layer.Vector("Flightwise", {
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: "http://mw1.google.com/mw-earth-vectordb/flightwise/flightwise_root.kml",
            format: new OpenLayers.Format.KML({
                extractStyles: true,
                extractAttributes: true
            })
        })
    })

    var marine = new OpenLayers.Layer.Vector("Marine", {
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: "http://www.marinetraffic.com/ais/ge_marinetraffic.kml",
            format: new OpenLayers.Format.KML({
                extractStyles: true,
                extractAttributes: true
            })
        })
    })

    var sundials = new OpenLayers.Layer.Vector("Sundials", {
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.HTTP({
            url: "http://openlayers.org/dev/examples/kml/sundials.kml",
            format: new OpenLayers.Format.KML({
                extractStyles: true,
                extractAttributes: true
            })
        })
    })

    map.addLayers([osm, flight, marine, sundials]);

    var controls = [
                    new OpenLayers.Control.Navigation(),                        
                    new OpenLayers.Control.LayerSwitcher(),                        
                    new OpenLayers.Control.ScaleLine(),                        
                    new OpenLayers.Control.MousePosition(),
                    /*new OpenLayers.Control.OverviewMap(),*/
                    new OpenLayers.Control.KeyboardDefaults()
                ];

    map.addControls(controls);


    map.zoomToMaxExtent();
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

For fetching remoteData, the maxDepth option must be greater than 0. This option tells the KML parser how far the traverse before giving up. Source

Try adding maxDepth: 20 or something. Play around with the number. I imagine you might have to go deep for the AIS data. Not sure.

...
format: new OpenLayers.Format.KML({
    extractStyles: true,
    extractAttributes: true,
    maxDepth: 20
})
...
share|improve this answer
    
Thank you for the answer , sadly this didn't work for me. Maybe I did something wrong... if you were able to do it , Ill be happy to see how. –  Alophind Nov 14 '12 at 7:44
    
Sorry, I haven't overlayed KMLs with network links. I just figured it was worth a try. –  CaptDragon Nov 14 '12 at 14:07
    
Hope anyone can help here. –  Alophind Nov 16 '12 at 17:51
    
pretty old question, but if you try the network link directly it will work. Your flightwise kml doesn't have 'Document' tag, which is needed for it to work on openlayers. Try the link inside flightwise instead. (but that one doesn't seem to work anymore now) –  Glenn Plas Nov 21 '13 at 17:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.