[OpenLayers-Users] Problem with Layer.vector

Eric Lemoine eric.lemoine at camptocamp.com
Tue Aug 4 00:47:47 EDT 2009


On Monday, August 3, 2009, Nicholas Efremov-Kendall
<n.e.kendall at gmail.com> wrote:
> Hi all,I've been trying to implement my gml as a layer.vector, as opposed to a layer.gml. I'm loading both into the browser with the different methods, and I can from firebug that the file is getting loaded, but it's not being displayed. Thus, if I re-sent my auto-center to sites2.events, it doesn't center at all. I'm not sure what going wrong here, I thought I'd followed the examples pretty closely. Thanks (again) in advance.
> //loads fine var	sites = new OpenLayers.Layer.GML (
>  		"Archaeological Sites", "data/siteswatr.gml",
>  		{
>  		style: {pointRadius: 2.5},
>  		projection: new OpenLayers.Projection("EPSG:4326"),
>  		format: OpenLayers.Format.GML,
>  		}
>  		);
>  	map.addLayer(sites);
>  // loads into browser but not displayed.
>  		var sites2 = new OpenLayers.Layer.Vector (
>  		"sites2", {projection: map.displayProjection, strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({url: "data/siteswatr.gml", format: [new OpenLayers.Format.GML()]})});
>  		map.addLayer(sites2);

Your code looks correct to me. The Fixed strategy empties the layer
before adding features into it, which could explain why you see one
set of features only. I'd recommend adding a break point in the fixed
strategy's merge() method to understand what's going on.

>
>
>

-- 
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