Loading KML tiles generated for Google Earth in Openlayers
first sorry for my english,i have a problem loading a kml file (tiled) into openlayers, the kml file is generated for google earth with this script http://cimss.ssec.wisc.edu/imapp/dbge_v1.2.shtml, you can see an example here: http://modis.umag.cl/desarrollo/kml/2011.09.18.1742.2_3/2011.09.18.1742.2_3.kml , it loads fine in google earth but i don't know how to do it in openlayers, i tried this:
var layer = new OpenLayers.Layer.Vector("KML", {
projection: map.displayProjection,
strategies: [new O开发者_StackOverflow社区penLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "http://modis.umag.cl/desarrollo/kml/2011.09.18.1742.2_3/2011.09.18.1742.2_3.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true,
maxDepth: 4
})
})
})
but is not showing in the map, any ideas??? thanks.
Add the following two lines to your code:
layer.setVisibility(true);
map.addLayer(layer);
Hope this helps you.If you are getting an error please mention those.It helps us to solve.
精彩评论