Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hy,

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 3 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 sollutions?

share|improve this question

1 Answer 1

You are referencing to 'http://www.freetrack.nl/js/OpenLayers.js' for Openlayers but the example http://dev.openlayers.org/releases/OpenLayers-2.11/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/releases/OpenLayers-2.11/lib/OpenLayers.js
share|improve this answer
    
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 '12 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 '12 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 '12 at 16:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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