To get familiar with GeoJSON / Openlayers , I tried to use this example
http://gis-lab.info/share/DR/sandbox/geojson.html (found it here on stackoverflow)
first step was to copy the html locally a and change the url to the geojson file from
"./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.
didn't work either
What am I missing ?
Try copying that data locally to "./data/l1.geojson"
to avoid Cross-domain issues. 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. read up on this .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.