Hello, 
i try to get the center of a just drawn regular Polygon with the follwing
code:

 added =function (feature)
            {

              var center=feature.geometry.getCentroid();
        
              alert(center.x);
            };

            controls = {
                regular: new OpenLayers.Control.DrawFeature(vectors,
                            OpenLayers.Handler.RegularPolygon,
                           
{eventListeners:{"featureadded":added},handlerOptions: {sides: 40}}),
                drag: new OpenLayers.Control.DragFeature(vectors)
            };


but the alert doesnt activate so there is a error. I think the argument
"feature" has not the type OpenLayers. Feature, but i cant find what exact
type feature has.

Is there perhaps a different way to get the center of the regular polygon?
Thanks a lot.
Marc
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Get-the-center-of-a-regular-Polygon-tp5893098p5893098.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to