大家好,我想要在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);