@types/googlemaps
Version:
TypeScript definitions for Google Maps JavaScript API
1,168 lines (1,096 loc) • 110 kB
TypeScript
// Type definitions for Google Maps JavaScript API 3.29
// Project: https://developers.google.com/maps/
// Definitions by: Folia A/S <http://www.folia.dk>, Chris Wrench <https://github.com/cgwrench>, Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Grant Hutchins <https://github.com/nertzy>, Denis Atyasov <https://github.com/xaolas>, Michael McMullin <https://github.com/mrmcnerd>, Martin Costello <https://github.com/martincostello>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
The MIT License
Copyright (c) 2012 Folia A/S. http://www.folia.dk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
declare namespace google.maps {
/***** Map *****/
export class Map extends MVCObject {
constructor(mapDiv: Element|null, opts?: MapOptions);
fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void;
getBounds(): LatLngBounds|null|undefined;
getCenter(): LatLng;
getDiv(): Element;
getHeading(): number;
getMapTypeId(): MapTypeId|string;
getProjection(): Projection;
getStreetView(): StreetViewPanorama;
getTilt(): number;
getZoom(): number;
panBy(x: number, y: number): void;
panTo(latLng: LatLng|LatLngLiteral): void;
panToBounds(latLngBounds: LatLngBounds|LatLngBoundsLiteral): void;
setCenter(latlng: LatLng|LatLngLiteral): void;
setHeading(heading: number): void;
setMapTypeId(mapTypeId: MapTypeId|string): void;
setOptions(options: MapOptions): void;
setStreetView(panorama: StreetViewPanorama): void;
setTilt(tilt: number): void;
setZoom(zoom: number): void;
controls: MVCArray<Node>[];
data: Data;
mapTypes: MapTypeRegistry;
overlayMapTypes: MVCArray<MapType>;
}
export interface MapOptions {
/**
* Color used for the background of the Map div. This color will be visible when
* tiles have not yet loaded as the user pans. This option can only be set when
* the map is initialized.
*/
backgroundColor?: string;
/** The initial Map center. Required. */
center?: LatLng|LatLngLiteral;
/**
* When false, map icons are not clickable. A map icon represents a point of
* interest, also known as a POI. By default map icons are clickable.
*/
clickableIcons?: boolean
/** Enables/disables all default UI. May be overridden individually. */
disableDefaultUI?: boolean;
/** Enables/disables zoom and center on double click. Enabled by default. */
disableDoubleClickZoom?: boolean;
/** If false, prevents the map from being dragged. Dragging is enabled by default. */
draggable?: boolean;
/**
* The name or url of the cursor to display when mousing over a draggable map.
* This property uses the css cursor attribute to change the icon. As with the
* css property, you must specify at least one fallback cursor that is not a URL.
* For example: draggableCursor: 'url(http://www.example.com/icon.png), auto;'.
*/
draggableCursor?: string;
/**
* The name or url of the cursor to display when the map is being dragged. This
* property uses the css cursor attribute to change the icon. As with the css
* property, you must specify at least one fallback cursor that is not a URL.
* For example: draggingCursor: 'url(http://www.example.com/icon.png), auto;'.
*/
draggingCursor?: string;
/** The enabled/disabled state of the Fullscreen control. */
fullscreenControl?: boolean;
/** The display options for the Fullscreen control. */
fullscreenControlOptions?: FullscreenControlOptions;
/**
* This setting controls how gestures on the map are handled.
*/
gestureHandling?: GestureHandlingOptions;
/**
* The heading for aerial imagery in degrees measured clockwise from cardinal
* direction North. Headings are snapped to the nearest available angle for
* which imagery is available.
*/
heading?: number;
/**
* If false, prevents the map from being controlled by the keyboard. Keyboard
* shortcuts are enabled by default.
*/
keyboardShortcuts?: boolean;
/** The initial enabled/disabled state of the Map type control. */
mapTypeControl?: boolean;
/** The initial display options for the Map type control. */
mapTypeControlOptions?: MapTypeControlOptions;
/** The initial Map mapTypeId. Defaults to ROADMAP. */
mapTypeId?: MapTypeId;
/**
* The maximum zoom level which will be displayed on the map. If omitted, or set
* to null, the maximum zoom from the current map type is used instead. Valid
* values: Integers between zero, and up to the supported maximum zoom level.
*/
maxZoom?: number;
/**
* The minimum zoom level which will be displayed on the map. If omitted, or set
* to null, the minimum zoom from the current map type is used instead. Valid
* values: Integers between zero, and up to the supported maximum zoom level.
*/
minZoom?: number;
/** If true, do not clear the contents of the Map div. */
noClear?: boolean;
overviewMapControl?: boolean;
overviewMapControlOptions?: OverviewMapControlOptions;
/**
* The enabled/disabled state of the Pan control.
* Note: The Pan control is not available in the new set of controls introduced
* in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you
* can choose to use the earlier set of controls rather than the new controls,
* thus making the Pan control available as part of the old control set.
* See {@link https://developers.google.com/maps/articles/v322-controls-diff|What's New in the v3.22 Map Controls}.
*/
panControl?: boolean;
/**
* The display options for the Pan control.
* Note: The Pan control is not available in the new set of controls introduced
* in v3.22 of the Google Maps JavaScript API. While using v3.22 and v3.23, you
* can choose to use the earlier set of controls rather than the new controls,
* thus making the Pan control available as part of the old control set.
* See {@link https://developers.google.com/maps/articles/v322-controls-diff|What's New in the v3.22 Map Controls}.
*/
panControlOptions?: PanControlOptions;
/** The enabled/disabled state of the Rotate control. */
rotateControl?: boolean;
/** The display options for the Rotate control. */
rotateControlOptions?: RotateControlOptions;
/** The initial enabled/disabled state of the Scale control. */
scaleControl?: boolean;
/** The initial display options for the Scale control. */
scaleControlOptions?: ScaleControlOptions;
/** If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default. */
scrollwheel?: boolean;
/**
* The enabled/disabled state of the sign in control. This option only applies if
* signed_in=true has been passed as a URL parameter in the bootstrap request.
* You may want to use this option to hide the map's sign in control if you have
* provided another way for your users to sign in, such as the Google Sign-In
* button. This option does not affect the visibility of the Google avatar shown
* when the user is already signed in.
*/
signInControl?: boolean;
/**
* A StreetViewPanorama to display when the Street View pegman is dropped on the
* map. If no panorama is specified, a default StreetViewPanorama will be
* displayed in the map's div when the pegman is dropped.
*/
streetView?: StreetViewPanorama;
/**
* The initial enabled/disabled state of the Street View Pegman control. This
* control is part of the default UI, and should be set to false when displaying
* a map type on which the Street View road overlay should not appear
* (e.g. a non-Earth map type).
*/
streetViewControl?: boolean;
/** The initial display options for the Street View Pegman control. */
streetViewControlOptions?: StreetViewControlOptions;
/**
* Styles to apply to each of the default map types. Note that for
* satellite/hybrid and terrain modes, these styles will only apply to labels
* and geometry.
*/
styles?: MapTypeStyle[];
/**
* Controls the automatic switching behavior for the angle of incidence of the
* map. The only allowed values are 0 and 45. The value 0 causes the map to
* always use a 0° overhead view regardless of the zoom level and viewport. The
* value 45 causes the tilt angle to automatically switch to 45 whenever 45°
* imagery is available for the current zoom level and viewport, and switch back
* to 0 whenever 45° imagery is not available (this is the default behavior).
* 45° imagery is only available for satellite and hybrid map types, within some
* locations, and at some zoom levels. Note: getTilt returns the current tilt
* angle, not the value specified by this option. Because getTilt and this option
* refer to different things, do not bind() the tilt property; doing so may yield
* unpredictable effects.
*/
tilt?: number;
/**
* The initial Map zoom level. Required. Valid values: Integers between zero, and
* up to the supported maximum zoom level.
*/
zoom?: number;
/** The enabled/disabled state of the Zoom control. */
zoomControl?: boolean;
/** The display options for the Zoom control. */
zoomControlOptions?: ZoomControlOptions;
}
/**
* Identifiers for common MapTypes. Specify these by value, or by using the
* constant's name. For example, 'satellite' or google.maps.MapTypeId.SATELLITE.
*/
export enum MapTypeId {
/** This map type displays a transparent layer of major streets on satellite images. */
HYBRID,
/** This map type displays a normal street map. */
ROADMAP,
/** This map type displays satellite images. */
SATELLITE,
/** This map type displays maps with physical features such as terrain and vegetation. */
TERRAIN
}
/***** Controls *****/
/** Options for the rendering of the map type control. */
export interface MapTypeControlOptions {
/** IDs of map types to show in the control. */
mapTypeIds?: (MapTypeId|string)[];
/**
* Position id. Used to specify the position of the control on the map.
* The default position is TOP_RIGHT.
*/
position?: ControlPosition;
/** Style id. Used to select what style of map type control to display. */
style?: MapTypeControlStyle;
}
export enum MapTypeControlStyle {
DEFAULT,
DROPDOWN_MENU,
HORIZONTAL_BAR
}
export interface OverviewMapControlOptions {
opened?: boolean;
}
export type GestureHandlingOptions =
"cooperative" |
"greedy" |
"none" |
"auto";
/** Options for the rendering of the pan control. */
export interface PanControlOptions {
/**
* Position id. Used to specify the position of the control on the map.
* The default position is TOP_LEFT.
*/
position?: ControlPosition;
}
/** Options for the rendering of the rotate control. */
export interface RotateControlOptions {
/**
* Position id. Used to specify the position of the control on the map.
* The default position is TOP_LEFT.
*/
position?: ControlPosition;
}
/** Options for the rendering of the scale control. */
export interface ScaleControlOptions {
/** Style id. Used to select what style of scale control to display. */
style?: ScaleControlStyle;
}
export enum ScaleControlStyle {
DEFAULT
}
/** Options for the rendering of the Street View pegman control on the map. */
export interface StreetViewControlOptions {
/**
* Position id. Used to specify the position of the control on the map. The
* default position is embedded within the navigation (zoom and pan) controls.
* If this position is empty or the same as that specified in the
* zoomControlOptions or panControlOptions, the Street View control will be
* displayed as part of the navigation controls. Otherwise, it will be displayed
* separately.
*/
position?: ControlPosition;
}
/** Options for the rendering of the zoom control. */
export interface ZoomControlOptions {
/**
* Position id. Used to specify the position of the control on the map.
* The default position is TOP_LEFT.
*/
position?: ControlPosition;
style?: ZoomControlStyle;
}
export enum ZoomControlStyle {
DEFAULT,
LARGE,
SMALL
}
/**
* Identifiers used to specify the placement of controls on the map. Controls are
* positioned relative to other controls in the same layout position. Controls that
* are added first are positioned closer to the edge of the map.
*/
export enum ControlPosition {
/** Elements are positioned in the center of the bottom row. */
BOTTOM_CENTER,
/**
* Elements are positioned in the bottom left and flow towards the middle.
* Elements are positioned to the right of the Google logo.
*/
BOTTOM_LEFT,
/**
* Elements are positioned in the bottom right and flow towards the middle.
* Elements are positioned to the left of the copyrights.
*/
BOTTOM_RIGHT,
/**
* Elements are positioned on the left, above bottom-left elements, and flow upwards.
*/
LEFT_BOTTOM,
/** Elements are positioned in the center of the left side. */
LEFT_CENTER,
/**
* Elements are positioned on the left, below top-left elements, and flow downwards.
*/
LEFT_TOP,
/**
* Elements are positioned on the right, above bottom-right elements, and flow upwards.
*/
RIGHT_BOTTOM,
/** Elements are positioned in the center of the right side. */
RIGHT_CENTER,
/** Elements are positioned on the right, below top-right elements, and flow downwards. */
RIGHT_TOP,
/** Elements are positioned in the center of the top row. */
TOP_CENTER,
/** Elements are positioned in the top left and flow towards the middle. */
TOP_LEFT,
/** Elements are positioned in the top right and flow towards the middle. */
TOP_RIGHT
}
type DrawingMode = 'Point' | 'LineString' | 'Polygon';
/***** Data *****/
export class Data extends MVCObject {
constructor(options?: Data.DataOptions);
add(feature: Data.Feature|Data.FeatureOptions): Data.Feature;
addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[];
contains(feature: Data.Feature): boolean;
forEach(callback: (feature: Data.Feature) => void): void;
getControlPosition(): ControlPosition;
getControls(): DrawingMode[];
getDrawingMode(): DrawingMode | null;
getFeatureById(id: number|string): Data.Feature;
getMap(): Map;
getStyle(): Data.StylingFunction|Data.StyleOptions;
loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void;
overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void;
remove(feature: Data.Feature): void;
revertStyle(feature?: Data.Feature): void;
setControlPosition(controlPosition: ControlPosition): void;
setControls(controls: DrawingMode[] | null): void;
setDrawingMode(drawingMode: DrawingMode | null): void;
setMap(map: Map | null): void;
setStyle(style: Data.StylingFunction|Data.StyleOptions): void;
toGeoJson(callback: (feature: Object) => void): void;
}
export module Data {
export interface DataOptions {
controlPosition?: ControlPosition;
controls?: string[];
drawingMode?: string;
featureFactory?: (geometry: Data.Geometry) => Data.Feature;
map?: Map;
style?: Data.StylingFunction|Data.StyleOptions;
}
export interface GeoJsonOptions {
idPropertyName?: string;
}
export interface StyleOptions {
clickable?: boolean;
cursor?: string;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
icon?: string|Icon|Symbol;
shape?: MarkerShape;
strokeColor?: string;
strokeOpacity?: number;
strokeWeight?: number;
title?: string;
visible?: boolean;
zIndex?: number;
}
export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions;
export class Feature {
constructor(options?: Data.FeatureOptions);
forEachProperty(callback: (value: any, name: string) => void): void;
getGeometry(): Data.Geometry;
getId(): number|string;
getProperty(name: string): any;
removeProperty(name: string): void;
setGeometry(newGeometry: Data.Geometry|LatLng|LatLngLiteral): void;
setProperty(name: string, newValue: any): void;
toGeoJson(callback: (feature: Object) => void): void;
}
export interface FeatureOptions {
geometry?: Data.Geometry|LatLng|LatLngLiteral;
id?: number|string;
properties?: Object;
}
export class Geometry {
getType(): string;
forEachLatLng(callback: (latLng: LatLng) => void): void;
}
export class Point extends Data.Geometry {
constructor(latLng: LatLng|LatLngLiteral);
get(): LatLng;
}
export class MultiPoint extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class LineString extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class MultiLineString extends Data.Geometry {
constructor(elements: (Data.LineString|(LatLng|LatLngLiteral)[])[]);
getArray(): Data.LineString[];
getAt(n: number): Data.LineString;
getLength(): number;
}
export class LinearRing extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class Polygon extends Data.Geometry {
constructor(elements: (Data.LinearRing|(LatLng|LatLngLiteral)[])[]);
getArray(): Data.LinearRing[];
getAt(n: number): Data.LinearRing;
getLength(): number;
}
export class MultiPolygon extends Data.Geometry {
constructor(elements: (Data.Polygon|(LinearRing|(LatLng|LatLngLiteral)[])[])[]);
getArray(): Data.Polygon[];
getAt(n: number): Data.Polygon;
getLength(): number;
}
export class GeometryCollection extends Data.Geometry {
constructor(elements: (Data.Geometry[]|LatLng[]|LatLngLiteral)[]);
getArray(): Data.Geometry[];
getAt(n: number): Data.Geometry;
getLength(): number;
}
export interface MouseEvent extends google.maps.MouseEvent {
feature: Data.Feature;
}
export interface AddFeatureEvent {
feature: Data.Feature;
}
export interface RemoveFeatureEvent {
feature: Data.Feature;
}
export interface SetGeometryEvent {
feature: Data.Feature;
newGeometry: Data.Geometry;
oldGeometry: Data.Geometry;
}
export interface SetPropertyEvent {
feature: Data.Feature;
name: string;
newValue: any;
oldValue: any;
}
export interface RemovePropertyEvent {
feature: Data.Feature;
name: string;
oldValue: any;
}
}
/***** Overlays *****/
export class Marker extends MVCObject {
static MAX_ZINDEX: number;
constructor(opts?: MarkerOptions);
getAnimation(): Animation;
getAttribution(): Attribution;
getClickable(): boolean;
getCursor(): string;
getDraggable(): boolean;
getIcon(): string|Icon|Symbol;
getLabel(): MarkerLabel;
getMap(): Map|StreetViewPanorama;
getOpacity(): number;
getPlace(): Place;
getPosition(): LatLng;
getShape(): MarkerShape;
getTitle(): string;
getVisible(): boolean;
getZIndex(): number;
setAnimation(animation: Animation|null): void;
setAttribution(attribution: Attribution): void;
setClickable(flag: boolean): void;
setCursor(cursor: string): void;
setDraggable(flag: boolean): void;
setIcon(icon: string|Icon|Symbol): void;
setLabel(label: string|MarkerLabel): void;
setMap(map: Map|StreetViewPanorama|null): void;
setOpacity(opacity: number): void;
setOptions(options: MarkerOptions): void;
setPlace(place: Place): void;
setPosition(latlng: LatLng|LatLngLiteral): void;
setShape(shape: MarkerShape): void;
setTitle(title: string): void;
setVisible(visible: boolean): void;
setZIndex(zIndex: number): void;
}
export interface MarkerOptions {
/**
* The offset from the marker's position to the tip of an InfoWindow
* that has been opened with the marker as anchor.
*/
anchorPoint?: Point;
/** Which animation to play when marker is added to a map. */
animation?: Animation;
/**
* If true, the marker receives mouse and touch events.
* @default true
*/
clickable?: boolean;
/** Mouse cursor to show on hover. */
cursor?: string;
/**
* If true, the marker can be dragged.
* @default false
*/
draggable?: boolean;
/**
* Icon for the foreground.
* If a string is provided, it is treated as though it were an Icon with the string as url.
* @type {(string|Icon|Symbol)}
*/
icon?: string|Icon|Symbol;
/**
* Adds a label to the marker. The label can either be a string, or a MarkerLabel object.
* Only the first character of the string will be displayed.
* @type {(string|MarkerLabel)}
*/
label?: string|MarkerLabel;
/**
* Map on which to display Marker.
* @type {(Map|StreetViewPanorama)}
*
*/
map?: Map|StreetViewPanorama;
/** The marker's opacity between 0.0 and 1.0. */
opacity?: number;
/**
* Optimization renders many markers as a single static element.
* Optimized rendering is enabled by default.
* Disable optimized rendering for animated GIFs or PNGs, or when each
* marker must be rendered as a separate DOM element (advanced usage
* only).
*/
optimized?: boolean;
/**
* Place information, used to identify and describe the place
* associated with this Marker. In this context, 'place' means a
* business, point of interest or geographic location. To allow a user
* to save this place, open an info window anchored on this marker.
* The info window will contain information about the place and an
* option for the user to save it. Only one of position or place can
* be specified.
*/
place?: Place;
/**
* Marker position. Required.
*/
position: LatLng|LatLngLiteral;
/** Image map region definition used for drag/click. */
shape?: MarkerShape;
/** Rollover text. */
title?: string;
/** If true, the marker is visible. */
visible?: boolean;
/**
* All markers are displayed on the map in order of their zIndex,
* with higher values displaying in front of markers with lower values.
* By default, markers are displayed according to their vertical position on screen,
* with lower markers appearing in front of markers further up the screen.
*/
zIndex?: number;
}
export interface Icon {
/**
* The position at which to anchor an image in correspondence to the
* location of the marker on the map. By default, the anchor is
* located along the center point of the bottom of the image.
*/
anchor?: Point;
/**
* The origin of the label relative to the top-left corner of the icon
* image, if a label is supplied by the marker. By default, the origin
* is located in the center point of the image.
*/
labelOrigin?: Point;
/**
* The position of the image within a sprite, if any. By default, the
* origin is located at the top left corner of the image (0, 0).
*/
origin?: Point;
/**
* The size of the entire image after scaling, if any. Use this
* property to stretch/ shrink an image or a sprite.
*/
scaledSize?: Size;
/**
* The display size of the sprite or image. When using sprites, you
* must specify the sprite size. If the size is not provided, it will
* be set when the image loads.
*/
size?: Size;
/** The URL of the image or sprite sheet. */
url?: string;
}
export interface MarkerLabel {
/** The color of the label text. Default color is black. */
color?: string;
/** The font family of the label text (equivalent to the CSS font-family property). */
fontFamily?: string;
/** The font size of the label text (equivalent to the CSS font-size property). Default size is 14px. */
fontSize?: string;
/** The font weight of the label text (equivalent to the CSS font-weight property). */
fontWeight?: string;
/** The text to be displayed in the label. Only the first character of this string will be shown. */
text?: string;
}
export interface MarkerShape {
coords?: number[];
type?: string;
}
export interface Symbol {
/**
* The position of the symbol relative to the marker or polyline.
* The coordinates of the symbol's path are translated left and up by the anchor's x and y coordinates respectively.
* By default, a symbol is anchored at (0, 0).
* The position is expressed in the same coordinate system as the symbol's path.
*/
anchor?: Point;
/**
* The symbol's fill color.
* All CSS3 colors are supported except for extended named colors. For symbol markers, this defaults to 'black'.
* For symbols on polylines, this defaults to the stroke color of the corresponding polyline.
*/
fillColor?: string;
/**
* The symbol's fill opacity.
* @default 0
*/
fillOpacity?: number;
/**
* The symbol's path, which is a built-in symbol path, or a custom path expressed using SVG path notation. Required.
* @type {(SymbolPath|string)}
*/
path?: SymbolPath|string;
/**
* The angle by which to rotate the symbol, expressed clockwise in degrees.
* Defaults to 0.
* A symbol in an IconSequence where fixedRotation is false is rotated relative to the angle of the edge on which it lies.
*/
rotation?: number;
/**
* The amount by which the symbol is scaled in size.
* For symbol markers, this defaults to 1; after scaling, the symbol may be of any size.
* For symbols on a polyline, this defaults to the stroke weight of the polyline;
* after scaling, the symbol must lie inside a square 22 pixels in size centered at the symbol's anchor.
*/
scale?: number;
/**
* The symbol's stroke color. All CSS3 colors are supported except for extended named colors.
* For symbol markers, this defaults to 'black'.
* For symbols on a polyline, this defaults to the stroke color of the polyline.
*/
strokeColor?: string;
/**
* The symbol's stroke opacity. For symbol markers, this defaults to 1.
* For symbols on a polyline, this defaults to the stroke opacity of the polyline.
*/
strokeOpacity?: number;
/** The symbol's stroke weight. Defaults to the scale of the symbol.v*/
strokeWeight?: number;
}
/** Built-in symbol paths. */
export enum SymbolPath {
/** A backward-pointing closed arrow. */
BACKWARD_CLOSED_ARROW,
/** A backward-pointing open arrow. */
BACKWARD_OPEN_ARROW,
/** A circle. */
CIRCLE,
/** A forward-pointing closed arrow. */
FORWARD_CLOSED_ARROW,
/** A forward-pointing open arrow. */
FORWARD_OPEN_ARROW
}
export enum Animation {
BOUNCE,
DROP
}
/**
* An overlay that looks like a bubble and is often connected to a marker.
* This class extends MVCObject.
*/
export class InfoWindow extends MVCObject {
/**
* Creates an info window with the given options. An InfoWindow can be
* placed on a map at a particular position or above a marker,
* depending on what is specified in the options. Unless auto-pan is
* disabled, an InfoWindow will pan the map to make itself visible
* when it is opened. After constructing an InfoWindow, you must call
* open to display it on the map. The user can click the close button
* on the InfoWindow to remove it from the map, or the developer can
* call close() for the same effect.
*/
constructor(opts?: InfoWindowOptions);
/** Closes this InfoWindow by removing it from the DOM structure. */
close(): void;
getContent(): string|Element;
getPosition(): LatLng;
getZIndex(): number;
/**
* Opens this InfoWindow on the given map. Optionally, an InfoWindow can be associated with an anchor.
* In the core API, the only anchor is the Marker class.
* However, an anchor can be any MVCObject that exposes a LatLng position property and optionally
* a Point anchorPoint property for calculating the pixelOffset (see InfoWindowOptions).
* The anchorPoint is the offset from the anchor's position to the tip of the InfoWindow.
*/
open(map?: Map|StreetViewPanorama, anchor?: MVCObject): void;
setContent(content: string|Node): void;
setOptions(options: InfoWindowOptions): void;
setPosition(position: LatLng|LatLngLiteral): void;
setZIndex(zIndex: number): void;
}
export interface InfoWindowOptions {
/**
* Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML.
* The InfoWindow will be sized according to the content.
* To set an explicit size for the content, set content to be a HTML element with that size.
* @type {(string|Node)}
*/
content?: string|Node;
/**
* Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens.
*/
disableAutoPan?: boolean;
/**
* Maximum width of the infowindow, regardless of content's width.
* This value is only considered if it is set before a call to open.
* To change the maximum width when changing content, call close, setOptions, and then open.
*/
maxWidth?: number;
/**
* The offset, in pixels, of the tip of the info window from the point on the map
* at whose geographical coordinates the info window is anchored.
* If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the anchor's anchorPoint property.
*/
pixelOffset?: Size;
/**
* The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead.
*/
position?: LatLng|LatLngLiteral;
/**
* All InfoWindows are displayed on the map in order of their zIndex,
* with higher values displaying in front of InfoWindows with lower values.
* By default, InfoWindows are displayed according to their latitude,
* with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes.
* InfoWindows are always displayed in front of markers.
*/
zIndex?: number;
}
export class Polyline extends MVCObject {
constructor(opts?: PolylineOptions);
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getPath(): MVCArray<LatLng>;
getVisible(): boolean;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map | null): void;
setOptions(options: PolylineOptions): void;
setPath(path: MVCArray<LatLng>|LatLng[]|LatLngLiteral[]): void;
setVisible(visible: boolean): void;
}
export interface PolylineOptions {
/** Indicates whether this Polyline handles mouse events. Defaults to true. */
clickable?: boolean;
/**
* If set to true, the user can drag this shape over the map.
* The geodesic property defines the mode of dragging. Defaults to false.
*/
draggable?: boolean;
/**
* If set to true, the user can edit this shape by dragging the control points shown at the vertices and on
* each segment. Defaults to false.
*/
editable?: boolean;
/**
* 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. Defaults to false.
*/
geodesic?: boolean;
/** The icons to be rendered along the polyline. */
icons?: IconSequence[];
/** Map on which to display Polyline. */
map?: Map;
/**
* The ordered sequence of coordinates of the Polyline.
* This path may be specified using either a simple array of LatLngs, or an MVCArray of LatLngs.
* 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.
*/
path?: MVCArray<LatLng>|LatLng[]|LatLngLiteral[];
/** The stroke color. All CSS3 colors are supported except for extended named colors. */
strokeColor?: string;
/** The stroke opacity between 0.0 and 1.0. */
strokeOpacity?: number;
/** The stroke width in pixels. */
strokeWeight?: number;
/** Whether this polyline is visible on the map. Defaults to true. */
visible?: boolean;
/** The zIndex compared to other polys. */
zIndex?: number;
}
export interface IconSequence {
fixedRotation?: boolean;
icon?: Symbol;
offset?: string;
repeat?: string;
}
export class Polygon extends MVCObject {
constructor(opts?: PolygonOptions);
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
/** Retrieves the first path. */
getPath(): MVCArray<LatLng>;
/** Retrieves the paths for this polygon. */
getPaths(): MVCArray<MVCArray<LatLng>>;
getVisible(): boolean;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map | null): void;
setOptions(options: PolygonOptions): void;
setPath(path: MVCArray<LatLng>|LatLng[]|LatLngLiteral[]): void;
setPaths(paths: MVCArray<MVCArray<LatLng>> | MVCArray<LatLng> | LatLng[][] | LatLngLiteral[][] | LatLng[] | LatLngLiteral[]): void;
setVisible(visible: boolean): void;
}
export interface PolygonOptions {
/** Indicates whether this Polygon handles mouse events. Defaults to true. */
clickable?: boolean;
/**
* If set to true, the user can drag this shape over the map.
* The geodesic property defines the mode of dragging. Defaults to false.
*/
draggable?: boolean;
/**
* If set to true, the user can edit this shape by dragging the control points
* shown at the vertices and on each segment. Defaults to false.
*/
editable?: boolean;
/** The fill color. All CSS3 colors are supported except for extended named colors. */
fillColor?: string;
/** The fill opacity between 0.0 and 1.0 */
fillOpacity?: number;
/**
* 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. Defaults to false.
*/
geodesic?: boolean;
/** Map on which to display Polygon. */
map?: Map;
/**
* 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 LatLngs. More
* complex polygons may specify an array of arrays. Any simple arrays are
* converted into MVCArrays. Inserting or removing LatLngs from the MVCArray
* will automatically update the polygon on the map.
*/
paths?: MVCArray<MVCArray<LatLng>> | MVCArray<LatLng> | LatLng[][] | LatLngLiteral[][] | LatLng[] | LatLngLiteral[];
/**
* The stroke color.
* All CSS3 colors are supported except for extended named colors.
*/
strokeColor?: string;
/** The stroke opacity between 0.0 and 1.0 */
strokeOpacity?: number;
/**
* The stroke position. Defaults to CENTER.
* This property is not supported on Internet Explorer 8 and earlier.
*/
strokePosition?: StrokePosition;
/** The stroke width in pixels. */
strokeWeight?: number;
/** Whether this polygon is visible on the map. Defaults to true. */
visible?: boolean;
/** The zIndex compared to other polys. */
zIndex?: number;
}
export interface PolyMouseEvent extends MouseEvent {
edge?: number;
path?: number;
vertex?: number;
}
export class Rectangle extends MVCObject {
constructor(opts?: RectangleOptions);
getBounds(): LatLngBounds;
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getVisible(): boolean;
setBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map | null): void;
setOptions(options: RectangleOptions): void;
setVisible(visible: boolean): void;
}
export interface RectangleOptions {
bounds?: LatLngBounds | LatLngBoundsLiteral;
clickable?: boolean;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
map?: Map;
strokeColor?: string;
strokeOpacity?: number;
strokePosition?: StrokePosition;
strokeWeight?: number;
visible?: boolean;
zIndex?: number;
}
/** A circle on the Earth's surface; also known as a "spherical cap". */
export class Circle extends MVCObject {
/** Create a circle using the passed CircleOptions, which specify the center, radius, and style. */
constructor(opts?: CircleOptions);
/** Gets the LatLngBounds of this Circle. */
getBounds(): LatLngBounds;
/** Returns the center of this circle. */
getCenter(): LatLng;
/** Returns whether this circle can be dragged by the user. */
getDraggable(): boolean;
/** Returns whether this circle can be edited by the user. */
getEditable(): boolean;
/** Returns the map on which this circle is displayed. */
getMap(): Map;
/** Returns the radius of this circle (in meters). */
getRadius(): number;
/** Returns whether this circle is visible on the map. */
getVisible(): boolean;
/** Sets the center of this circle. */
setCenter(center: LatLng|LatLngLiteral): void;
/** If set to true, the user can drag this circle over the map. */
setDraggable(draggable: boolean): void;
/**
* 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.
*/
setEditable(editable: boolean): void;
/** Renders the circle on the specified map. If map is set to null, the circle will be removed. */
setMap(map: Map | null): void;
setOptions(options: CircleOptions): void;
/** Sets the radius of this circle (in meters). */
setRadius(radius: number): void;
/** Hides this circle if set to false. */
setVisible(visible: boolean): void;
}
export interface CircleOptions {
/** The center */
center?: LatLng|LatLngLiteral;
/** Indicates whether this Circle handles mouse events. Defaults to true. */
clickable?: boolean;
/** If set to true, the user can drag this circle over the map. Defaults to false. */
draggable?: boolean;
/**
* 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. Defaults to false.
*/
editable?: boolean;
/** The fill color. All CSS3 colors are supported except for extended named colors. */
fillColor?: string;
/** The fill opacity between 0.0 and 1.0 */
fillOpacity?: number;
/** Map on which to display Circle. */
map?: Map;
/** The radius in meters on the Earth's surface */
radius?: number;
/** The stroke color. All CSS3 colors are supported except for extended named colors. */
strokeColor?: string;
/** The stroke opacity between 0.0 and 1.0 */
strokeOpacity?: number;
/**
* The stroke position. Defaults to CENTER. This property is not supported on Internet Explorer 8 and earlier.
*/
strokePosition?: StrokePosition;
/** The stroke width in pixels. */
strokeWeight?: number;
/** Whether this circle is visible on the map. Defaults to true. */
visible?: boolean;
/** The zIndex compared to other polys. */
zIndex?: number;
}
/**
* The possible positions of the stroke on a polygon.
*/
export enum StrokePosition {
/**
* The stroke is centered on the polygon's path, with half the stroke inside
* the polygon and half the stroke outside the polygon.
*/
CENTER,
/** The stroke lies inside the polygon. */
INSIDE,
/** The stroke lies outside the polygon. */
OUTSIDE
}
export class GroundOverlay extends MVCObject {
constructor(url: string, bounds: LatLngBounds|LatLngBoundsLiteral, opts?: GroundOverlayOptions);
getBounds(): LatLngBounds;
getMap(): Map;
getOpacity(): number;
getUrl(): string;
setMap(map: Map | null): void;
setOpacity(opacity: number): void;
}
export interface GroundOverlayOptions {
clickable?: boolean;
map?: Map;
opacity?: number;
}
export class OverlayView extends MVCObject {
draw(): void;
getMap(): Map|StreetViewPanorama;
getPanes(): MapPanes;
getProjection(): MapCanvasProjection;
onAdd(): void;
onRemove(): void;
setMap(map: Map | StreetViewPanorama | null): void;
}
export interface MapPanes {
floatPane: Element;
floatShadow: Element;
mapPane: Element;
markerLayer: Element;
overlayImage: Element;
overlayLayer: Element;
overlayMouseTarget: Element;
overlayShadow: Element;
}
export class MapCanvasProjection extends MVCObject {
fromContainerPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
fromDivPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
fromLatLngToContainerPixel(latLng: LatLng): Point;
fromLatLngToDivPixel(latLng: LatLng): Point;
getWorldWidth(): number;
}
/***** Services *****/
export class Geocoder {
geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void ): void;
}
export interface GeocoderRequest {
address?: string;
bounds?: LatLngBounds|LatLngBoundsLiteral;
componentRestrictions?: GeocoderComponentRestrictions;
location?: LatLng|LatLngLiteral;
placeId?: string;
region?: string;
}
export interface GeocoderComponentRestrictions {
administrativeArea?: string;