[OpenLayers-Dev] Problem adding a new handler

Eric Lemoine eric.lemoine at camptocamp.com
Tue Jul 21 16:46:32 EDT 2009

On Tuesday, July 21, 2009, Camilo Vargas <cavargasru at gmail.com> wrote:
> Hello,


> I'm trying to develop a new handler for one special app using openlayers.
> The process which I followed was create one based on the RegularPolygon add new javascript in the openlayers.js in the jsfiles array. But once I try the new handler with:
> new OpenLayers.Control.DrawFeature(crater, OpenLayers.Handler.RegularPolygon1, {
>         handlerOptions: {
>              irregular: true
>         }
> I got this exception.
> Exception: this.handler.setMap is not a function File: Line: 236 Column: 0
> Obviuslly i'm missing something but I don't really know what it is.

The error means that the handler the draw feature control creates by
instatiating your RegularPolygon1 class does not have a setMap method.
So there most probably is a problem with way you define the
RegularPolygon1 class. In its (almost) simplest form it would look
like this:

OpenLayers.Handler.RegularPolygon1 =
OpenLayers.Class(OpenLayers.Handler.RegularPolygon, {
    initialize: function(control, options) {


Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com

More information about the Dev mailing list