[英]loading an external GeoJSON into Openlayers
To get familiar with GeoJSON / Openlayers , I tried to use this example 为了熟悉GeoJSON / Openlayers,我尝试使用此示例
http://gis-lab.info/share/DR/sandbox/geojson.html (found it here on stackoverflow) http://gis-lab.info/share/DR/sandbox/geojson.html (发现这里的计算器)
first step was to copy the html locally a and change the url to the geojson file from 第一步是在本地复制html并将url从以下位置更改为geojson文件
"./data/l1.geojson"
to 至
"http://gis-lab.info/share/DR/sandbox/data/l1.geojson"
no other changes made, but it didn't work .. 没有其他更改,但没有用..
2nd try was to just put the geojson file locally. 第二次尝试是将geojson文件放在本地。
didn't work either 也不起作用
What am I missing ? 我想念什么?
Try copying that data locally to "./data/l1.geojson"
to avoid Cross-domain issues. 尝试将该数据本地复制到
"./data/l1.geojson"
以避免跨域问题。 Be aware of the browser's same origin policy . 请注意浏览器的原始策略 。
If calling the that exists on a seperate domain is a requirement, then get the data first using Ajax, JSONP or back-end proxy then feed it into openlayers. 如果需要调用存在于单独域中的,则首先使用Ajax,JSONP或后端代理获取数据,然后将其输入到openlayers中。 read up on this .
阅读这个 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.