I have made some examples showing timezones.kml on top of my map in openlayers v3.8.2 without any big issues but this kml (document.kml) of mine just does not want to work.It just doesn't show at all. It loads perfectly in Google Eart and you should be able to have a look at it there if you want to see how it should be.
This is one version of my code that doesn't show the vector layer (or showing it in the wrong place/hidden/scaled so small I can't find it or whatever).
I haven't got the grasp of all this yet and would be very happy for some help on the way.
var raster = new ol.layer.Tile({ source: new ol.source.OSM("Thunderforest.Landscape", ["http://a.tile.thunderforest.com/landscape/${z}/${x}/${y}.png", "http://b.tile.thunderforest.com/landscape/${z}/${x}/${y}.png", "http://c.tile.thunderforest.com/landscape//${z}/${x}/${y}.png"])})var vector = new ol.layer.Vector({ source: new ol.source.Vector({ url: 'path/to/document.kml', format: new ol.format.KML({ extractStyles: true, extractAttributes: true}) }) }); var map = new ol.Map({ target: 'map', layers: [ raster, vector, ], view: new ol.View({ center: ol.proj.transform([12.58,58.76], 'EPSG:4326', 'EPSG:3857'), zoom: 13 }) });
أكثر...
This is one version of my code that doesn't show the vector layer (or showing it in the wrong place/hidden/scaled so small I can't find it or whatever).
I haven't got the grasp of all this yet and would be very happy for some help on the way.
var raster = new ol.layer.Tile({ source: new ol.source.OSM("Thunderforest.Landscape", ["http://a.tile.thunderforest.com/landscape/${z}/${x}/${y}.png", "http://b.tile.thunderforest.com/landscape/${z}/${x}/${y}.png", "http://c.tile.thunderforest.com/landscape//${z}/${x}/${y}.png"])})var vector = new ol.layer.Vector({ source: new ol.source.Vector({ url: 'path/to/document.kml', format: new ol.format.KML({ extractStyles: true, extractAttributes: true}) }) }); var map = new ol.Map({ target: 'map', layers: [ raster, vector, ], view: new ol.View({ center: ol.proj.transform([12.58,58.76], 'EPSG:4326', 'EPSG:3857'), zoom: 13 }) });
أكثر...