作者VGGG (Yang)
看板Web_Design
标题[问题] Openlayer载入GeoJSON资料
时间Thu Oct 6 22:32:29 2016
大家好,我想要在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);
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.116.47.116
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1475764351.A.EC7.html