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.

This is my code for displaying geojson in OpenLayers, where "geourl" is directed to a json file in Amazon S3.

geojson_layer = new OpenLayers.Layer.Vector("GeoJSON", {
    strategies: [new OpenLayers.Strategy.Fixed()],
    protocol: new OpenLayers.Protocol.HTTP({
    url:geourl,
    format: new OpenLayers.Format.GeoJSON()})
    });

But I received the error like this:

> Failed to load resource: the server responded with a status of 403
> (Forbidden) "geourl" Failed to load resource: No
> 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:8081' is therefore not allowed
> access. "geourl" XMLHttpRequest cannot load  "geourl" No
> 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:8081' is therefore not allowed
> access.

Nothing changed when I added

self.response.headers.add_header("Access-Control-Allow-Origin", "*")

to my webapp RequestHandler Class.

share|improve this question
    
What exactly is your question? –  RyanDalton Mar 5 at 19:26
    
I cannot load json file (stored in S3) to OpenLayers. –  Mingshu Mar 5 at 19:45
    
Possibly related: Enabling CORS in OpenLayers –  blah238 Mar 5 at 20:15
    
It looks like there is no equivalent "crossOrigin" property on the GeoJSONOptions class. Not sure what that means, though. –  blah238 Mar 5 at 20:16
    
Very closely related: Problem loading a GeoJSON file using Openlayers –  blah238 Mar 5 at 20:24
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.