我将GeoJSON导入到我的地图中,但我的浏览器显示以下错误消息:
SyntaxError:JSON.parse:JSON数据第1行第1列的意外字符
Convert base class to derived class
(点击)
这是我的剧本:
< !doctype html >
< html lang = "en" >
< head >
< link rel = 'stylesheet'
href = 'css/ol.css' >
< style > #map {
height: 100 % ;
width: 100 % ;
} < /style>
<title>OpenLayers 3 example</title >
< script src = "build/ol.js"
type = "text/javascript" > < /script>
</head >
< body >
< h1 > My Map < /h1>
<div id="map"></div >
< script type = "text/javascript" >
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Vector({
title: 'added Layer',
source: new ol.source.GeoJSON({
projection: 'EPSG:4326',
url: 'gjson/test.geojson'
})
})
],
view: new ol.View({
center: [0, 0],
zoom: 2
})
}); < /script>
</body >
< /html>
&#13;
我犯了错误?我不知道如何解决这个问题。