Drawing Library Stay organized with collections Save and categorize content based on your preferences.
DrawingManagerclass
google.maps.drawing.DrawingManagerclass
Deprecated: Drawing library functionality in the Maps JavaScript API is deprecated. This API was deprecated in August 2025 and will be made unavailable in a later version of the Maps JavaScript API, releasing in May 2026. For more info, seehttps://developers.google.com/maps/deprecations
Allows users to draw markers, polygons, polylines, rectangles, and circles on the map. TheDrawingManager'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 extendsMVCObject.
Access by callingconst {DrawingManager} = await google.maps.importLibrary("drawing").
SeeLibraries in the Maps JavaScript API.
Constructor | |
|---|---|
DrawingManager | DrawingManager([options])Parameters:
Creates a DrawingManager that 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 Map to which theDrawingManager is attached, which is theMap on 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 ofnull means 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 DrawingManager object 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. |
DrawingManagerOptionsinterface
google.maps.drawing.DrawingManagerOptionsinterface
Options for the drawing manager.
Properties | |
|---|---|
circleOptionsoptional | Type: CircleOptionsoptionalOptions to apply to any new circles created with this DrawingManager. Thecenter andradius properties are ignored, and themap property of a new circle is always set to theDrawingManager's map. |
drawingControloptional | Type: booleanoptionalDefault: trueThe enabled/disabled state of the drawing control. |
drawingControlOptionsoptional | Type: DrawingControlOptionsoptionalThe display options for the drawing control. |
drawingModeoptional | Type: OverlayTypeoptionalThe 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 ofnull means that the user can interact with the map as normal, and clicks do not draw anything. |
mapoptional | Type: MapoptionalThe Map to which theDrawingManager is attached, which is theMap on which the overlays created will be placed. |
markerOptionsoptional | Type: MarkerOptionsoptionalOptions to apply to any new markers created with this DrawingManager. Theposition property is ignored, and themap property of a new marker is always set to theDrawingManager's map. |
polygonOptionsoptional | Type: PolygonOptionsoptionalOptions to apply to any new polygons created with this DrawingManager. Thepaths property is ignored, and themap property of a new polygon is always set to theDrawingManager's map. |
polylineOptionsoptional | Type: PolylineOptionsoptionalOptions to apply to any new polylines created with this DrawingManager. Thepath property is ignored, and themap property of a new polyline is always set to theDrawingManager's map. |
rectangleOptionsoptional | Type: RectangleOptionsoptionalOptions to apply to any new rectangles created with this DrawingManager. Thebounds property is ignored, and themap property of a new rectangle is always set to theDrawingManager's map. |
DrawingControlOptionsinterface
google.maps.drawing.DrawingControlOptionsinterface
Options for the rendering of the drawing control.
Properties | |
|---|---|
drawingModesoptional | 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 null drawing mode) is always available and is not to be specified in this array. |
positionoptional | Type: ControlPositionoptionalDefault: ControlPosition.TOP_LEFTPosition id. Used to specify the position of the control on the map. |
OverlayCompleteEventinterface
google.maps.drawing.OverlayCompleteEventinterface
The properties of an overlaycomplete event on aDrawingManager.
Properties | |
|---|---|
overlay | The completed overlay. |
type | Type: OverlayTypeThe completed overlay's type. |
OverlayTypeconstants
google.maps.drawing.OverlayTypeconstants
The types of overlay that may be created by theDrawingManager. Specify these by value, or by using the constant's name. For example,'polygon' orgoogle.maps.drawing.OverlayType.POLYGON.
Access by callingconst {OverlayType} = await google.maps.importLibrary("drawing").
SeeLibraries in the Maps JavaScript API.
Constants | |
|---|---|
CIRCLE | Specifies that theDrawingManager creates circles, and that the overlay given in theoverlaycomplete event is a circle. |
MARKER | Specifies that theDrawingManager creates markers, and that the overlay given in theoverlaycomplete event is a marker. |
POLYGON | Specifies that theDrawingManager creates polygons, and that the overlay given in theoverlaycomplete event is a polygon. |
POLYLINE | Specifies that theDrawingManager creates polylines, and that the overlay given in theoverlaycomplete event is a polyline. |
RECTANGLE | Specifies that theDrawingManager creates rectangles, and that the overlay given in theoverlaycomplete event is a rectangle. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-11-21 UTC.