DrawingManager class
google.maps.drawing.DrawingManager
class
Allows users to draw markers, polygons, polylines, rectangles, and circles on the map. The DrawingManager's drawing mode defines the type of overlay that will be created by the user. Adds a control to the map, allowing the user to switch drawing mode.
This class extends
MVCObject.
Access by calling const {DrawingManager} = await google.maps.importLibrary("drawing"). 
See Libraries in the Maps JavaScript API.
| Constructor | |
|---|---|
| DrawingManager | DrawingManager([options])Parameters:   
 Creates a  DrawingManagerthat allows users to draw overlays on the map, and switch between the type of overlay to be drawn with a drawing control. | 
| Methods | |
|---|---|
| getDrawingMode | getDrawingMode()Parameters:  None Return Value:   OverlayType|nullReturns the  DrawingManager's drawing mode. | 
| getMap | getMap()Parameters:  None Return Value:   MapReturns the  Mapto which theDrawingManageris attached, which is theMapon which the overlays created will be placed. | 
| setDrawingMode | setDrawingMode(drawingMode)Parameters:   
 Return Value:  None Changes the  DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are'marker','polygon','polyline','rectangle','circle', ornull. A drawing mode ofnullmeans that the user can interact with the map as normal, and clicks do not draw anything. | 
| setMap | setMap(map)Parameters:   
 Return Value:  None Attaches the  DrawingManagerobject to the specifiedMap. | 
| setOptions | setOptions(options)Parameters:   
 Return Value:  None Sets the  DrawingManager's options. | 
| Inherited: addListener,bindTo,get,notify,set,setValues,unbind,unbindAll | |
| Events | |
|---|---|
| circlecomplete | function(circle)Arguments:   
 This event is fired when the user has finished drawing a circle. | 
| markercomplete | function(marker)Arguments:   
 This event is fired when the user has finished drawing a marker. | 
| overlaycomplete | function(event)Arguments:   
 This event is fired when the user has finished drawing an overlay of any type. | 
| polygoncomplete | function(polygon)Arguments:   
 This event is fired when the user has finished drawing a polygon. | 
| polylinecomplete | function(polyline)Arguments:   
 This event is fired when the user has finished drawing a polyline. | 
| rectanglecomplete | function(rectangle)Arguments:   
 This event is fired when the user has finished drawing a rectangle. | 
DrawingManagerOptions interface
google.maps.drawing.DrawingManagerOptions
interface
Options for the drawing manager.
| Properties | |
|---|---|
| circleOptions optional | Type:   CircleOptions optionalOptions to apply to any new circles created with this  DrawingManager. Thecenterandradiusproperties are ignored, and themapproperty of a new circle is always set to theDrawingManager's map. | 
| drawingControl optional | Type:   boolean optionalDefault:  trueThe enabled/disabled state of the drawing control. | 
| drawingControlOptions optional | Type:   DrawingControlOptions optionalThe display options for the drawing control. | 
| drawingMode optional | Type:   OverlayType optionalThe  DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are'marker','polygon','polyline','rectangle','circle', ornull. A drawing mode ofnullmeans that the user can interact with the map as normal, and clicks do not draw anything. | 
| map optional | Type:   Map optionalThe  Mapto which theDrawingManageris attached, which is theMapon which the overlays created will be placed. | 
| markerOptions optional | Type:   MarkerOptions optionalOptions to apply to any new markers created with this  DrawingManager. Thepositionproperty is ignored, and themapproperty of a new marker is always set to theDrawingManager's map. | 
| polygonOptions optional | Type:   PolygonOptions optionalOptions to apply to any new polygons created with this  DrawingManager. Thepathsproperty is ignored, and themapproperty of a new polygon is always set to theDrawingManager's map. | 
| polylineOptions optional | Type:   PolylineOptions optionalOptions to apply to any new polylines created with this  DrawingManager. Thepathproperty is ignored, and themapproperty of a new polyline is always set to theDrawingManager's map. | 
| rectangleOptions optional | Type:   RectangleOptions optionalOptions to apply to any new rectangles created with this  DrawingManager. Theboundsproperty is ignored, and themapproperty of a new rectangle is always set to theDrawingManager's map. | 
DrawingControlOptions interface
google.maps.drawing.DrawingControlOptions
interface
Options for the rendering of the drawing control.
| Properties | |
|---|---|
| drawingModes optional | Type:   Array<OverlayType> optionalDefault:  [The drawing modes to display in the drawing control, in the order in which they are to be displayed. The hand icon (which corresponds to the  nulldrawing mode) is always available and is not to be specified in this array. | 
| position optional | Type:   ControlPosition optionalDefault:  ControlPosition.TOP_LEFTPosition id. Used to specify the position of the control on the map. | 
OverlayCompleteEvent interface
google.maps.drawing.OverlayCompleteEvent
interface
The properties of an overlaycomplete event on a DrawingManager.
| Properties | |
|---|---|
| overlay | The completed overlay. | 
| type | Type:   OverlayTypeThe completed overlay's type. | 
OverlayType constants
google.maps.drawing.OverlayType
constants
The types of overlay that may be created by the DrawingManager. Specify these by value, or by using the constant's name. For example, 'polygon' or google.maps.drawing.OverlayType.POLYGON.
Access by calling const {OverlayType} = await google.maps.importLibrary("drawing"). 
See Libraries in the Maps JavaScript API.
| Constants | |
|---|---|
| CIRCLE | Specifies that the DrawingManagercreates circles, and that the overlay given in theoverlaycompleteevent is a circle. | 
| MARKER | Specifies that the DrawingManagercreates markers, and that the overlay given in theoverlaycompleteevent is a marker. | 
| POLYGON | Specifies that the DrawingManagercreates polygons, and that the overlay given in theoverlaycompleteevent is a polygon. | 
| POLYLINE | Specifies that the DrawingManagercreates polylines, and that the overlay given in theoverlaycompleteevent is a polyline. | 
| RECTANGLE | Specifies that the DrawingManagercreates rectangles, and that the overlay given in theoverlaycompleteevent is a rectangle. |