1

I'm working on a jsFiddle with a OpenLayers example in it. http://dev.openlayers.org/releases/OpenLayers-2.11/examples/snapping.html

At the moment it's not working because it's not getting a response for the http request to get data. How do I fix that?

The jsFiddle is here: http://jsfiddle.net/TcuxA/6/ Go to the line "// create three vector layers" in the script. There are three requests for data. If you type the URLs in your browser you get the JSON, but my Firebug gives 3 errors when I run the jsFiddle.

I tried fixing with jsFiddle echo, but that didn't work. I don't know how to change the script to load the data otherwise.

Why can't I get the JSON by these URLs? What are good solutions?

0

1 Answer 1

2

You are referencing to 'http://www.freetrack.nl/js/OpenLayers.js' for Openlayers but the example http://dev.openlayers.org/examples/snapping.html is using 'http://dev.openlayers.org/releases/OpenLayers-2.11/lib/OpenLayers.js' which is different to your openlayers.js and missing all the libraries [Single File Library] that are required.

replace:

http://www.freetrack.nl/js/OpenLayers.js
with
http://dev.openlayers.org/lib/OpenLayers.js
3
  • oh, oops, I fixed that in the next version and I gave the map some width and height. The problem is the jsons containing all the poly's, lines and points. How do I fix that. See: jsfiddle.net/TcuxA/7
    – Jeroen
    Jun 22, 2012 at 17:14
  • jsFiddle it won't get the data because the URL doesn't conform to en.wikipedia.org/wiki/Same_origin_policy - stackoverflow.com/questions/6690123/…
    – Mapperz
    Jun 22, 2012 at 17:20
  • Adding '&callback=?' to the URL didn't solve it. Since you can just view those jsons in your browser, I tried to put them into a var in the code and 'load' them that way in the Vector layer, but I'm not sure how to do that. jsfiddle.net/TcuxA/9 I also tried the Script protocol to fix the same origin issue. But it gives some errors on the returned object. jsfiddle.net/TcuxA/10
    – Jeroen
    Jun 23, 2012 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.