[OpenLayers-Users] Help with Box Handler
Heidt, Christopher M.
CHRISTOPHER.M.HEIDT at saic.com
Thu Nov 13 18:07:20 EST 2008
I'm attempting to use the Box Handler to allow the user to draw a bounding box on the map. (code below)
the problem im having is that the feature that ends up being created is suppose to be a polygon with the same bounds produced by the box,
but what i end up with is an extreamly tiny polygon at 0,0.
I'm using a google base so i thought maybe the projection was the culprit, but i've tried transforming the bounds and nothing good seems to come from it.
any ideas?
var control = new OpenLayers.Control({
draw: function () {
this.box = new OpenLayers.Handler.Box( control,
{done: this.notice},
{keyMask: OpenLayers.Handler.MOD_SHIFT});
this.box.activate();
},
notice: function (bounds){
var geom = bounds.toGeometry();
var feature = new OpenLayers.Feature.Vector(geom);
_bboxLayer.addFeatures(feature);
_map.zoomToExtent(bounds,true);
}
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081113/d2ee45f1/attachment.html
More information about the Users
mailing list