Polyline class
google.maps
. Polyline
class
A polyline is a linear overlay of connected line segments on the map.
This class extends MVCObject
.
Access by calling const {Polyline} = await google.maps.importLibrary("maps")
.See Libraries in the Maps JavaScript API
.
Constructor
Polyline([opts])
-
opts
:PolylineOptions optional
PolylineOptions
, which specify both the path of the polyline and the stroke style to use when drawing the polyline. You may pass either an array of LatLng
s or an MVCArray
of LatLng
s when constructing a polyline, though simple arrays are converted to MVCArray
s within the polyline upon instantiation.Methods
getDraggable()
boolean
getEditable()
boolean
getVisible()
boolean
setDraggable(draggable)
-
draggable
:boolean
true
, the user can drag this shape over the map. The geodesic
property defines the mode of dragging.setEditable(editable)
-
editable
:boolean
true
, the user can edit this shape by dragging the control points shown at the vertices and on each segment.setMap(map)
-
map
:Map optional
null
, the shape will be removed.setPath(path)
-
path
:MVCArray < LatLng >| Array < LatLng | LatLngLiteral >
setVisible(visible)
-
visible
:boolean
false
.Events
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
PolylineOptions interface
google.maps
. PolylineOptions
interface
PolylineOptions object used to define the properties that can be set on a Polyline.
Properties |
|
---|---|
clickable
optional
|
Type:
boolean optional
Default:
true
Indicates whether this
Polyline
handles mouse events. |
draggable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can drag this shape over the map. The geodesic
property defines the mode of dragging. |
editable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can edit this shape by dragging the control points shown at the vertices and on each segment. |
geodesic
optional
|
Type:
boolean optional
Default:
false
When
true
, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false
, edges of the polygon are rendered as straight lines in screen space. Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. |
icons
optional
|
Type:
Array
< IconSequence
> optional
The icons to be rendered along the polyline.
|
map
optional
|
Type:
Map
optional
Map on which to display Polyline.
|
path
optional
|
Type:
MVCArray
< LatLng
>| Array
< LatLng
| LatLngLiteral
> optional
The ordered sequence of coordinates of the Polyline. This path may be specified using either a simple array of
LatLng
s, or an MVCArray
of LatLng
s. Note that if you pass a simple array, it will be converted to an MVCArray
Inserting or removing LatLngs in the MVCArray
will automatically update the polyline on the map. |
strokeColor
optional
|
Type:
string optional
The stroke color. All CSS3 colors are supported except for extended named colors.
|
strokeOpacity
optional
|
Type:
number optional
The stroke opacity between 0.0 and 1.0.
|
strokeWeight
optional
|
Type:
number optional
The stroke width in pixels.
|
visible
optional
|
Type:
boolean optional
Default:
true
Whether this polyline is visible on the map.
|
zIndex
optional
|
Type:
number optional
The zIndex compared to other polys.
|
IconSequence interface
google.maps
. IconSequence
interface
Describes how icons are to be rendered on a line.
If your polyline is geodesic, then the distances specified for both offset and repeat are calculated in meters by default. Setting either offset or repeat to a pixel value will cause the distances to be calculated in pixels on the screen.
Properties |
|
---|---|
fixedRotation
optional
|
Type:
boolean optional
Default:
false
If
true
, each icon in the sequence has the same fixed rotation regardless of the angle of the edge on which it lies. If false
, case each icon in the sequence is rotated to align with its edge. |
icon
optional
|
Type:
Symbol
optional
The icon to render on the line.
|
offset
optional
|
Type:
string optional
Default:
'100%'
The distance from the start of the line at which an icon is to be rendered. This distance may be expressed as a percentage of line's length (e.g. '50%') or in pixels (e.g. '50px').
|
repeat
optional
|
Type:
string optional
Default:
0
The distance between consecutive icons on the line. This distance may be expressed as a percentage of the line's length (e.g. '50%') or in pixels (e.g. '50px'). To disable repeating of the icon, specify '0'.
|
Polygon class
google.maps
. Polygon
class
A polygon (like a polyline) defines a series of connected coordinates in an ordered sequence. Additionally, polygons form a closed loop and define a filled region. See the samples in the developer's guide, starting with a simple polygon , a polygon with a hole , and more. Note that you can also use the Data layer to create a polygon. The Data layer offers a simpler way of creating holes because it handles the order of the inner and outer paths for you.
This class extends MVCObject
.
Access by calling const {Polygon} = await google.maps.importLibrary("maps")
.See Libraries in the Maps JavaScript API
.
Constructor
Polygon([opts])
-
opts
:PolygonOptions optional
PolygonOptions
, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions. A polygon may contain one or more paths, where each path consists of an array of LatLng
s. You may pass either an array of LatLngs or an MVCArray
of LatLng
s when constructing these paths. Arrays are converted to MVCArray
s within the polygon upon instantiation.Methods
getDraggable()
boolean
getEditable()
boolean
getVisible()
boolean
setDraggable(draggable)
-
draggable
:boolean
true
, the user can drag this shape over the map. The geodesic
property defines the mode of dragging.setEditable(editable)
-
editable
:boolean
true
, the user can edit this shape by dragging the control points shown at the vertices and on each segment.setMap(map)
-
map
:Map optional
null
, the shape will be removed.setPath(path)
-
path
:MVCArray < LatLng >| Array < LatLng | LatLngLiteral >
setVisible(visible)
-
visible
:boolean
false
.Events
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
function(event)
-
event
:PolyMouseEvent
PolygonOptions interface
google.maps
. PolygonOptions
interface
PolygonOptions object used to define the properties that can be set on a Polygon.
Properties |
|
---|---|
clickable
optional
|
Type:
boolean optional
Default:
true
Indicates whether this
Polygon
handles mouse events. |
draggable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can drag this shape over the map. The geodesic
property defines the mode of dragging. |
editable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can edit this shape by dragging the control points shown at the vertices and on each segment. |
fillColor
optional
|
Type:
string optional
The fill color. All CSS3 colors are supported except for extended named colors.
|
fillOpacity
optional
|
Type:
number optional
The fill opacity between 0.0 and 1.0
|
geodesic
optional
|
Type:
boolean optional
Default:
false
When
true
, edges of the polygon are interpreted as geodesic and will follow the curvature of the Earth. When false
, edges of the polygon are rendered as straight lines in screen space. Note that the shape of a geodesic polygon may appear to change when dragged, as the dimensions are maintained relative to the surface of the earth. |
map
optional
|
Type:
Map
optional
Map on which to display Polygon.
|
paths
optional
|
Type:
MVCArray
< MVCArray
< LatLng
>>| MVCArray
< LatLng
>| Array
< Array
< LatLng
| LatLngLiteral
>>| Array
< LatLng
| LatLngLiteral
> optional
The ordered sequence of coordinates that designates a closed loop. Unlike polylines, a polygon may consist of one or more paths. As a result, the paths property may specify one or more arrays of
LatLng
coordinates. Paths are closed automatically; do not repeat the first vertex of the path as the last vertex. Simple polygons may be defined using a single array of LatLng
s. More complex polygons may specify an array of arrays. Any simple arrays are converted into MVCArray
s. Inserting or removing LatLng
s from the MVCArray
will automatically update the polygon on the map. |
strokeColor
optional
|
Type:
string optional
The stroke color. All CSS3 colors are supported except for extended named colors.
|
strokeOpacity
optional
|
Type:
number optional
The stroke opacity between 0.0 and 1.0
|
strokePosition
optional
|
Type:
StrokePosition
optional
Default:
StrokePosition.CENTER
The stroke position.
|
strokeWeight
optional
|
Type:
number optional
The stroke width in pixels.
|
visible
optional
|
Type:
boolean optional
Default:
true
Whether this polygon is visible on the map.
|
zIndex
optional
|
Type:
number optional
The zIndex compared to other polys.
|
PolyMouseEvent interface
google.maps
. PolyMouseEvent
interface
This object is returned from mouse events on polylines and polygons.
This interface extends MapMouseEvent
.
Properties |
|
---|---|
edge
optional
|
Type:
number optional
The index of the edge within the path beneath the cursor when the event occurred, if the event occurred on a mid-point on an editable polygon.
|
path
optional
|
Type:
number optional
The index of the path beneath the cursor when the event occurred, if the event occurred on a vertex and the polygon is editable. Otherwise
undefined
. |
vertex
optional
|
Type:
number optional
The index of the vertex beneath the cursor when the event occurred, if the event occurred on a vertex and the polyline or polygon is editable. If the event does not occur on a vertex, the value is
undefined
. |
Inherited:
domEvent
, latLng
|
Methods |
|
---|---|
Inherited:
stop
|
Rectangle class
google.maps
. Rectangle
class
A rectangle overlay.
This class extends MVCObject
.
Access by calling const {Rectangle} = await google.maps.importLibrary("maps")
.See Libraries in the Maps JavaScript API
.
Constructor
Rectangle([opts])
-
opts
:RectangleOptions optional
Methods
getDraggable()
boolean
getEditable()
boolean
getMap()
Map
|null
getVisible()
boolean
setBounds(bounds)
-
bounds
:LatLngBounds | LatLngBoundsLiteral optional
setDraggable(draggable)
-
draggable
:boolean
true
, the user can drag this rectangle over the map.setEditable(editable)
-
editable
:boolean
true
, the user can edit this rectangle by dragging the control points shown at the corners and on each edge.setMap(map)
-
map
:Map optional
null
, the rectangle will be removed.setVisible(visible)
-
visible
:boolean
false
.Events
function()
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
RectangleOptions interface
google.maps
. RectangleOptions
interface
RectangleOptions object used to define the properties that can be set on a Rectangle.
Properties |
|
---|---|
bounds
optional
|
Type:
LatLngBounds
| LatLngBoundsLiteral
optional
The bounds.
|
clickable
optional
|
Type:
boolean optional
Default:
true
Indicates whether this
Rectangle
handles mouse events. |
draggable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can drag this rectangle over the map. |
editable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can edit this rectangle by dragging the control points shown at the corners and on each edge. |
fillColor
optional
|
Type:
string optional
The fill color. All CSS3 colors are supported except for extended named colors.
|
fillOpacity
optional
|
Type:
number optional
The fill opacity between 0.0 and 1.0
|
map
optional
|
Type:
Map
optional
Map on which to display Rectangle.
|
strokeColor
optional
|
Type:
string optional
The stroke color. All CSS3 colors are supported except for extended named colors.
|
strokeOpacity
optional
|
Type:
number optional
The stroke opacity between 0.0 and 1.0
|
strokePosition
optional
|
Type:
StrokePosition
optional
Default:
StrokePosition.CENTER
The stroke position.
|
strokeWeight
optional
|
Type:
number optional
The stroke width in pixels.
|
visible
optional
|
Type:
boolean optional
Default:
true
Whether this rectangle is visible on the map.
|
zIndex
optional
|
Type:
number optional
The zIndex compared to other polys.
|
Circle class
google.maps
. Circle
class
A circle on the Earth's surface; also known as a "spherical cap".
This class extends MVCObject
.
Access by calling const {Circle} = await google.maps.importLibrary("maps")
.See Libraries in the Maps JavaScript API
.
Constructor
Circle([circleOrCircleOptions])
-
circleOrCircleOptions
:Circle | CircleLiteral | CircleOptions optional
Methods
getDraggable()
boolean
getEditable()
boolean
getMap()
Map
|null
getRadius()
number
getVisible()
boolean
setCenter(center)
-
center
:LatLng | LatLngLiteral optional
setDraggable(draggable)
-
draggable
:boolean
true
, the user can drag this circle over the map.setEditable(editable)
-
editable
:boolean
true
, the user can edit this circle by dragging the control points shown at the center and around the circumference of the circle.setMap(map)
-
map
:Map optional
null
, the circle will be removed.setRadius(radius)
-
radius
:number
setVisible(visible)
-
visible
:boolean
false
.Events
function()
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function(event)
-
event
:MapMouseEvent
function()
function(event)
-
event
:MapMouseEvent
CircleOptions interface
google.maps
. CircleOptions
interface
CircleOptions object used to define the properties that can be set on a Circle.
Properties |
|
---|---|
center
optional
|
Type:
LatLng
| LatLngLiteral
optional
The center of the Circle.
|
clickable
optional
|
Type:
boolean optional
Default:
true
Indicates whether this
Circle
handles mouse events. |
draggable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can drag this circle over the map. |
editable
optional
|
Type:
boolean optional
Default:
false
If set to
true
, the user can edit this circle by dragging the control points shown at the center and around the circumference of the circle. |
fillColor
optional
|
Type:
string optional
The fill color. All CSS3 colors are supported except for extended named colors.
|
fillOpacity
optional
|
Type:
number optional
The fill opacity between 0.0 and 1.0.
|
map
optional
|
Type:
Map
optional
Map on which to display the Circle.
|
radius
optional
|
Type:
number optional
The radius in meters on the Earth's surface.
|
strokeColor
optional
|
Type:
string optional
The stroke color. All CSS3 colors are supported except for extended named colors.
|
strokeOpacity
optional
|
Type:
number optional
The stroke opacity between 0.0 and 1.0.
|
strokePosition
optional
|
Type:
StrokePosition
optional
Default:
StrokePosition.CENTER
The stroke position.
|
strokeWeight
optional
|
Type:
number optional
The stroke width in pixels.
|
visible
optional
|
Type:
boolean optional
Default:
true
Whether this circle is visible on the map.
|
zIndex
optional
|
Type:
number optional
The zIndex compared to other polys.
|
StrokePosition constants
google.maps
. StrokePosition
constants
The possible positions of the stroke on a polygon.
Access by calling const {StrokePosition} = await google.maps.importLibrary("maps")
.See Libraries in the Maps JavaScript API
.
Constants |
|
---|---|
CENTER
|
The stroke is centered on the polygon's path, with half the stroke inside the polygon and half the stroke outside the polygon. |
INSIDE
|
The stroke lies inside the polygon. |
OUTSIDE
|
The stroke lies outside the polygon. |