作者:
VGGG (Yang)
2016-10-06 22:32:29大家好,我想要在OSM上載入GeoJSON的資料,查看網路範例仍跑不出來
想請各位高手幫忙看看哪裡出問題,謝謝!
var osmlayer = new ol.layer.Tile({ //載入OSM
source: new ol.source.OSM()
});
views = new ol.View({
center: [13400000, 2650000], //起始值
zoom:10,
});
map = new ol.Map({
target:'map',
view: views
});
var geo = new ol.layer.Vector({ //載入GeoJSON檔
source: new ol.source.GeoJSON({
projection: 'EPSG:3857',
url: '/~E/NCKU2.geojson',
})
});
map.addLayer(osmlayer);
map.addLayer(geo);