AW: [OpenLayers-Users] struggling to draw a simple rectange
Arnd Wippermann
arnd.wippermann at web.de
Thu Jan 19 12:50:19 EST 2012
Hi,
You shoud add a feature not a geometry
var vectorLayer = new OpenLayers.Layer.Vector("layer");
//as the funtion says, you get a geometry
var p = new OpenLayers.Bounds(0,0,10,10).transform(
new OpenLayers.Projection("EPSG:4326"),
new OpenLayers.Projection("EPSG:900913")
).toGeometry();
//console.log(p.CLASS_NAME);
var ft = new OpenLayers.Feature.Vector(p);
map.addLayer(vectorLayer);
vectorLayer.addFeatures([ft]);
Arnd
-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Mr. Puneet
Kishor
Gesendet: Donnerstag, 19. Januar 2012 14:59
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] struggling to draw a simple rectange
This is just not obvious to me, apologies for that. I am trying to draw a
rectangle on a Google Maps base layer.
var vectorLayer = new OpenLayers.Layer.Vector("layer");
var p = new OpenLayers.Bounds(0,0,10,10).transform(
new OpenLayers.Projection("EPSG:4326"),
new OpenLayers.Projection("EPSG:900913")
).toGeometry();
map.addLayer(vectorLayer);
vectorLayer.addFeatures([p]);
The above does nothing for me. Please set me right.
--
Puneet Kishor_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
More information about the Users
mailing list