[OpenLayers-Users] Example of GeoJson fetch via HTTP?
rajjad at gmail.com
Mon Feb 27 23:30:37 EST 2012
var geojson_format = new OpenLayers.Format.GeoJSON(); // for json response
var vectorlayer=map.getLayersByName(layerName); // get the layer
this is how I do it, you did not mention the source of your JSON response.
Is it coming from some Gis server or a custom service, because you need to
embed the response as a script in the browser and it should be calling a
On Tue, Feb 28, 2012 at 8:36 AM, Scott Chapman <scott at mischko.com> wrote:
> I've got a map and want to add a layer to it from a bunch of GeoJSON
> formatted features that I can fetch from the server at
> /kiosks_status_geoJSON/. The server will return JSON format output.
> Can someone point me to an example of how to do this or lay it out for me?
> Some of my points of confusion include:
> 1) The docs (
> say that a GeoJSON Format.read() will deserialize a GeoJSON string,
> but the example
> already been deserialized. Is it smart enough to deal with both
> 2) The overall flow of things. I think I should make a Request.GET
> to fetch the URL, an event handler to deal with the response having a
> Format.geoJSON.read() the result and vector_layer.addFeatures on that.
> I'd love to see an example of this setup.
> Users mailing list
> Users at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users