[OpenLayers-Users] Neither Markers nor Features show markers with version 2.13
Thomas Gratier
osgeo.mailinglist at gmail.com
Tue Oct 14 19:43:49 PDT 2014
Hi,
Go to
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/draw-feature.html
and open your js debugger
The code below makes the job for example
//Because a closure, I get the vector point layer indirectly
var pointLayer = map.layers[1];
//Declare the new feature
var newFeature = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Point(5, 5),
{
'key1': 'abcdef',
'key2': 'ghijkl'
}
)
pointLayer.addFeatures([newFeature]);
// Enjoy (tested in Firefox and Google Chrome)
// This code above comes mainly from this old tutorial (good enough to get
started with OpenLayers 2.x version)
http://docs.openlayers.org/library/introduction.html#adding-a-vector-marker-to-the-map
// You might consider more recent docs too
http://workshops.boundlessgeo.com/openlayers-intro/
As a reminder, before asking, consider searching. OpenLayers v 2.x is
really documented everywhere and since a long time.
Cheers
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20141015/581242ca/attachment.html>
More information about the Users
mailing list