I can add the marker on the openlayer map using Openlayers.Layer.markers
. But i cannot do this using OpenLayers.Feature.Vector
? . Any one may help me..please...thanks in advance
Regards, Boomiraj.P
here's a simple example that should work.
var point = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(-111.04, 45.68));
var layer = new OpenLayers.Layer.Vector("My Layer", {
style: OpenLayers.Feature.Vector.style["default"]
});
map.addLayer(layer);
layer.addFeatures([point]);
This also does the trick:
var point = new OpenLayers.LonLat( -0.1279688 ,51.5077286 ).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject());
var markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
markers.addMarker(new OpenLayers.Marker(point));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.