[OpenLayers-Users] Add feature to layer

Uwe Gehring uwe at imap.cc
Sun Sep 22 11:45:07 PDT 2013


Hi all,

I am struggling with adding a feature to a layer object, which
represents a GPX file.

My code to create a layer is:

---------
var layerGPX_2 = new OpenLayers.Layer.Vector("10.5.05 11:01 (127,5km)",
{
	strategies: [new OpenLayers.Strategy.Fixed()],
	protocol: new OpenLayers.Protocol.HTTP({url:
"/Biking/Mallorca/CYC_20050512-1055.gpx",format: new
OpenLayers.Format.GPX()}),
	style: {strokeColor: "#000064", strokeWidth: 6, strokeOpacity: 0.7},
	projection: wgs84,
	features: [new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LineString,{test: "TEST"})],
});
--------

I am quite sure that the problem lies with the Geometry object while
adding the feature. Maybe it should refer to the concrete linestring
which comes from the GPX track, but I do not know how to refer it.

TIA and kind regards,
Uwe

-- 
Uwe Gehring
uwe at imap.cc



More information about the Users mailing list