# shape

type | shape

init

`

    $( selector ).geomap( {
      shape: function( e, geo ) { }
    } );

`

bind

`

    $( selector ).bind( "geomapshape", function( e, geo ) { } );
    } );

`

The shape event triggers when the user measures a length, or area, or draws a point, line or polygon. He or she does this by tapping the map in specific ways while the geomap mode property is set to: measureLength, measureArea, drawPoint, drawLineString or drawPolygon.

When mode is drawPoint, a single tap of the map triggers this event passing a GeoJSON Point object of the tapped location in map coordinates.

When mode is measureLength or drawLineString, the first single tap begins a line. Subsequent single taps add points to the line. A double-tap on the map adds a final point and triggers this event passing a GeoJSON LineString object of the measured length or sketched line in map coordinates.

When mode is measureArea or drawPolygon, the first single tap begins a polygon. Subsequent single taps add points to the polygon. A double-tap on the map adds a final point and triggers this event passing a GeoJSON Polygon object of the measured area or sketched polygon in map coordinates.

While measuring or drawing a shape, the user can pan the map by dragging or zoom the map with the mouse wheel. This will not interrupt their current measuring or drawing.

If you allow users to both measure and draw in your app, be sure to check the mode option in your event handler to determine if this event was triggered by measuring or by drawing. For example, you may want to append the shape to the map during drawPolygon but not during measureArea.