[OpenLayers-Users] data displays in wrong position, after switch to Layer.Vector

Eric Lemoine eric.lemoine at camptocamp.com
Sat Aug 1 16:04:20 EDT 2009


On Saturday, August 1, 2009, Nicholas Efremov-Kendall
<n.e.kendall at gmail.com> wrote:
> Hi all,
> I tried switching my application over from Layer.GML to Layer.Vector.
> here's the original code which displayed in the correct place:
> 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,
> 			}			);Here's the modified code which displays in the S. Atlantic ocean.
>
> var	sites = new OpenLayers.Layer.Vector (			"Archaeological Sites", {
>                     strategies: [new OpenLayers.Strategy.Fixed()],                    protocol: new OpenLayers.Protocol.HTTP({                        url: "data/siteswatr.gml",
> 						style: {pointRadius: 2.5}, 						projection: new OpenLayers.Projection("EPSG:4326"),
>                         format: new OpenLayers.Format.GML(),			})                });		map.addLayer(sites);
>
> I'm sure I messed something up, but what did I do wrong?thanks,Nick

Hi. The projection should be set in the layer not in the protocol.

Cheers,

>

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