[OpenLayers-Dev] Cross-domain problem with a external vector layer in format GeoJSON or GeoJSONP

Andreas Hocevar ahocevar at opengeo.org
Wed Nov 7 06:51:01 PST 2012


Hi,

this question would be better suited for the openlayers-users list. If
your layer is available in GeoJSONP format, you will want to use
OpenLayers.Strategy.Script instead of OpenLayers.Strategy.Fixed. See
http://openlayers.org/dev/examples/cross-origin.html for an example.

Andreas.

On Wed, Nov 7, 2012 at 3:27 PM, Miguel-Angel Manso-Callejo (UPM)
<m.manso at upm.es> wrote:
> Dear all,
>
> I'm trying to add a dinamic layer of earthquakes over a tiled WMS layer.
> Feeds of earthquakes are provided by USGS
> (http://earthquake.usgs.gov/earthquakes/feed/) in different formats included
> GeoJSON and GeoJSONP.
>
> I have included next Jscript to add the vector layer
>
>             var vector_layer = new OpenLayers.Layer.Vector("GeoJSON", {
>                 projection: "EPSG:4326",
>                 strategies: [new OpenLayers.Strategy.Fixed()],
>                 protocol: new OpenLayers.Protocol.HTTP({
>                     url:
> "http://earthquake.usgs.gov/earthquakes/feed/geojson/2.5/day",
>                     format: new OpenLayers.Format.GeoJSON({ ignoreExtraDims:
> true })
>                 })
>             });
>             map.addLayer(vector_layer);
>
> But none of the browsers (IE, FireFox or Chrome) shows the points of the
> earthquakes.
>
> Can any one help me, please?
>
> Best regards,
> Miguel A. Manso
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Dev mailing list