[OpenLayers-Users] using Request.GET vs. Layer with strategy,
protocol, format
Scott Chapman
scott at mischko.com
Fri Mar 2 14:41:51 EST 2012
Didn't work.
On Fri, Mar 2, 2012 at 11:29 AM, Eric Lemoine
<eric.lemoine at camptocamp.com> wrote:
>
>
> On Friday, March 2, 2012, Scott Chapman <scott at mischko.com> wrote:
>> Here's my current code. "A" works. "B" doesn't.
>> Is there something else I need to add to make the features actually show
>> up?
>>
>> //A:
>> var vector_layer = new OpenLayers.Layer.Vector("Stores");
>> map.addLayer(vector_layer);
>>
>> OpenLayers.Request.GET({
>> url: "/kiosks_status_geoJSON/",
>> headers: {'Accept':'application/json'},
>> success: function (req)
>> {
>> var g = new OpenLayers.Format.GeoJSON();
>> var feature_collection = g.read(req.responseText);
>> //console.log(feature_collection);
>> vector_layer.destroyFeatures();
>> vector_layer.addFeatures(feature_collection);
>> }
>> });
>> //vs:
>>
>> //B:
>> var vector_layer = new OpenLayers.Layer.Vector("Stores", {
>> strategies: [new OpenLayers.Strategy.Cluster(), new
>> OpenLayers.Strategy.Fixed()],
>> protocol: new OpenLayers.Protocol.HTTP({
>> url: "/kiosks_status_geoJSON/",
>> headers: {'Accept':'application/json'},
>> format: new OpenLayers.Format.GeoJSON()
>> })
>> });
>> map.addLayer(vector_layer);
>
> What if you remove the cluster strategy?
>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
>
More information about the Users
mailing list