UNPKG

139 kBTypeScriptView Raw
1// Type definitions for Google Maps JavaScript API 3.38
2// Project: https://developers.google.com/maps/
3// Definitions by: Chris Wrench <https://github.com/cgwrench>,
4// Kiarash Ghiaseddin <https://github.com/Silver-Connection>,
5// Grant Hutchins <https://github.com/nertzy>,
6// Denis Atyasov <https://github.com/xaolas>,
7// Michael McMullin <https://github.com/mrmcnerd>,
8// Martin Costello <https://github.com/martincostello>,
9// Sven Kreiss <https://github.com/svenkreiss>
10// Umar Bolatov <https://github.com/bolatovumar>
11// Michael Gauthier <https://github.com/gauthierm>
12// Colin Doig <https://github.com/captain-igloo>
13// Dmitry Demensky <https://github.com/demensky>
14// Vladimir Dashukevich <https://github.com/life777>
15// Simon Haenisch <https://github.com/simonhaenisch>
16// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
17
18// TypeScript Version: 2.7
19
20/*
21The MIT License
22
23Copyright (c) 2012 Folia A/S. http://www.folia.dk
24
25Permission is hereby granted, free of charge, to any person obtaining a copy
26of this software and associated documentation files (the "Software"), to deal
27in the Software without restriction, including without limitation the rights
28to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29copies of the Software, and to permit persons to whom the Software is
30furnished to do so, subject to the following conditions:
31
32The above copyright notice and this permission notice shall be included in
33all copies or substantial portions of the Software.
34
35THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
41THE SOFTWARE.
42*/
43
44declare namespace google.maps {
45 /***** Map *****/
46 class Map extends MVCObject {
47 constructor(mapDiv: Element | null, opts?: MapOptions);
48 fitBounds(bounds: LatLngBounds | LatLngBoundsLiteral, padding?: number | Padding): void;
49 getBounds(): LatLngBounds | null | undefined;
50 getCenter(): LatLng;
51 getDiv(): Element;
52 getHeading(): number;
53 getMapTypeId(): MapTypeId;
54 getProjection(): Projection | null;
55 getStreetView(): StreetViewPanorama;
56 getTilt(): number;
57 getZoom(): number;
58 panBy(x: number, y: number): void;
59 panTo(latLng: LatLng | LatLngLiteral): void;
60 panToBounds(latLngBounds: LatLngBounds | LatLngBoundsLiteral, padding?: number | Padding): void;
61 setCenter(latlng: LatLng | LatLngLiteral): void;
62 setHeading(heading: number): void;
63 setMapTypeId(mapTypeId: MapTypeId | string): void;
64 setOptions(options: MapOptions): void;
65 setStreetView(panorama: StreetViewPanorama): void;
66 setTilt(tilt: number): void;
67 setZoom(zoom: number): void;
68 controls: Array<MVCArray<Node>>;
69 data: Data;
70 mapTypes: MapTypeRegistry;
71 overlayMapTypes: MVCArray<MapType>;
72 setClickableIcons(clickable: boolean): void;
73 }
74
75 interface Padding {
76 bottom: number;
77 left: number;
78 right: number;
79 top: number;
80 }
81
82 interface MapOptions {
83 /**
84 * Color used for the background of the Map div. This color will be visible
85 * when tiles have not yet loaded as the user pans. This option can only be
86 * set when the map is initialized.
87 */
88 backgroundColor?: string;
89 /** The initial Map center. Required. */
90 center?: LatLng | LatLngLiteral;
91 /**
92 * When false, map icons are not clickable. A map icon represents a point of
93 * interest, also known as a POI. By default map icons are clickable.
94 */
95 clickableIcons?: boolean;
96 /**
97 * Size in pixels of the controls appearing on the map. This value must be
98 * supplied directly when creating the Map, updating this value later may
99 * bring the controls into an undefined state. Only governs the controls
100 * made by the Maps API itself. Does not scale developer created custom
101 * controls.
102 */
103 controlSize?: number;
104 /** Enables/disables all default UI. May be overridden individually. */
105 disableDefaultUI?: boolean;
106 /** Enables/disables zoom and center on double click. Enabled by default. */
107 disableDoubleClickZoom?: boolean;
108 /**
109 * If false, prevents the map from being dragged. Dragging is enabled by
110 * default.
111 */
112 draggable?: boolean;
113 /**
114 * The name or url of the cursor to display when mousing over a draggable
115 * map. This property uses the css cursor attribute to change the icon. As
116 * with the css property, you must specify at least one fallback cursor that
117 * is not a URL. For example: draggableCursor:
118 * 'url(http://www.example.com/icon.png), auto;'.
119 */
120 draggableCursor?: string;
121 /**
122 * The name or url of the cursor to display when the map is being dragged.
123 * This property uses the css cursor attribute to change the icon. As with
124 * the css property, you must specify at least one fallback cursor that is
125 * not a URL. For example: draggingCursor:
126 * 'url(http://www.example.com/icon.png), auto;'.
127 */
128 draggingCursor?: string;
129 /** The enabled/disabled state of the Fullscreen control. */
130 fullscreenControl?: boolean;
131 /** The display options for the Fullscreen control. */
132 fullscreenControlOptions?: FullscreenControlOptions;
133 /**
134 * This setting controls how gestures on the map are handled.
135 */
136 gestureHandling?: GestureHandlingOptions;
137 /**
138 * The heading for aerial imagery in degrees measured clockwise from
139 * cardinal direction North. Headings are snapped to the nearest available
140 * angle for which imagery is available.
141 */
142 heading?: number;
143 /**
144 * If false, prevents the map from being controlled by the keyboard.
145 * Keyboard shortcuts are enabled by default.
146 */
147 keyboardShortcuts?: boolean;
148 /** The initial enabled/disabled state of the Map type control. */
149 mapTypeControl?: boolean;
150 /** The initial display options for the Map type control. */
151 mapTypeControlOptions?: MapTypeControlOptions;
152 /** The initial Map mapTypeId. Defaults to ROADMAP. */
153 mapTypeId?: MapTypeId | string;
154 /**
155 * The maximum zoom level which will be displayed on the map. If omitted, or
156 * set to null, the maximum zoom from the current map type is used instead.
157 * Valid values: Integers between zero, and up to the supported maximum zoom
158 * level.
159 */
160 maxZoom?: number;
161 /**
162 * The minimum zoom level which will be displayed on the map. If omitted, or
163 * set to null, the minimum zoom from the current map type is used instead.
164 * Valid values: Integers between zero, and up to the supported maximum zoom
165 * level.
166 */
167 minZoom?: number;
168 /** If true, do not clear the contents of the Map div. */
169 noClear?: boolean;
170 /**
171 * The enabled/disabled state of the Pan control.
172 * Note: The Pan control is not available in the new set of controls
173 * introduced in v3.22 of the Google Maps JavaScript API. While using v3.22
174 * and v3.23, you can choose to use the earlier set of controls rather than
175 * the new controls, thus making the Pan control available as part of the
176 * old control set. See {@link
177 * https://developers.google.com/maps/articles/v322-controls-diff|What's New
178 * in the v3.22 Map Controls}.
179 */
180 panControl?: boolean;
181 /**
182 * The display options for the Pan control.
183 * Note: The Pan control is not available in the new set of controls
184 * introduced in v3.22 of the Google Maps JavaScript API. While using v3.22
185 * and v3.23, you can choose to use the earlier set of controls rather than
186 * the new controls, thus making the Pan control available as part of the
187 * old control set. See {@link
188 * https://developers.google.com/maps/articles/v322-controls-diff|What's New
189 * in the v3.22 Map Controls}.
190 */
191 panControlOptions?: PanControlOptions;
192 /**
193 * Defines a boundary that restricts the area of the map accessible to users.
194 * When set, a user can only pan and zoom while the camera view stays inside the
195 * limits of the boundary.
196 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.restriction Maps JavaScript API}
197 */
198 restriction?: MapRestriction;
199 /** The enabled/disabled state of the Rotate control. */
200 rotateControl?: boolean;
201 /** The display options for the Rotate control. */
202 rotateControlOptions?: RotateControlOptions;
203 /** The initial enabled/disabled state of the Scale control. */
204 scaleControl?: boolean;
205 /** The initial display options for the Scale control. */
206 scaleControlOptions?: ScaleControlOptions;
207 /**
208 * If false, disables scrollwheel zooming on the map. The scrollwheel is
209 * enabled by default.
210 */
211 scrollwheel?: boolean;
212 /**
213 * A StreetViewPanorama to display when the Street View pegman is dropped on
214 * the map. If no panorama is specified, a default StreetViewPanorama will
215 * be displayed in the map's div when the pegman is dropped.
216 */
217 streetView?: StreetViewPanorama;
218 /**
219 * The initial enabled/disabled state of the Street View Pegman control.
220 * This control is part of the default UI, and should be set to false when
221 * displaying a map type on which the Street View road overlay should not
222 * appear (e.g. a non-Earth map type).
223 */
224 streetViewControl?: boolean;
225 /** The initial display options for the Street View Pegman control. */
226 streetViewControlOptions?: StreetViewControlOptions;
227 /**
228 * Styles to apply to each of the default map types. Note that for
229 * satellite/hybrid and terrain modes, these styles will only apply to
230 * labels and geometry.
231 */
232 styles?: MapTypeStyle[];
233 /**
234 * Controls the automatic switching behavior for the angle of incidence of
235 * the map. The only allowed values are 0 and 45. The value 0 causes the map
236 * to always use a 0° overhead view regardless of the zoom level and
237 * viewport. The value 45 causes the tilt angle to automatically switch to
238 * 45 whenever 45° imagery is available for the current zoom level and
239 * viewport, and switch back to 0 whenever 45° imagery is not available
240 * (this is the default behavior). 45° imagery is only available for
241 * satellite and hybrid map types, within some locations, and at some zoom
242 * levels. Note: getTilt returns the current tilt angle, not the value
243 * specified by this option. Because getTilt and this option refer to
244 * different things, do not bind() the tilt property; doing so may yield
245 * unpredictable effects.
246 */
247 tilt?: number;
248 /**
249 * The initial Map zoom level. Required. Valid values: Integers between
250 * zero, and up to the supported maximum zoom level.
251 */
252 zoom?: number;
253 /** The enabled/disabled state of the Zoom control. */
254 zoomControl?: boolean;
255 /** The display options for the Zoom control. */
256 zoomControlOptions?: ZoomControlOptions;
257 }
258
259 /**
260 * Identifiers for common MapTypes. Specify these by value, or by using the
261 * constant's name. For example, 'satellite' or
262 * google.maps.MapTypeId.SATELLITE.
263 */
264 enum MapTypeId {
265 /** This map type displays a transparent layer of major streets on satellite images. */
266 HYBRID = 'hybrid',
267 /** This map type displays a normal street map. */
268 ROADMAP = 'roadmap',
269 /** This map type displays satellite images. */
270 SATELLITE = 'satellite',
271 /** This map type displays maps with physical features such as terrain and vegetation. */
272 TERRAIN = 'terrain',
273 }
274
275 /***** Controls *****/
276 /** Options for the rendering of the map type control. */
277 interface MapTypeControlOptions {
278 /** IDs of map types to show in the control. */
279 mapTypeIds?: Array<MapTypeId | string>;
280 /**
281 * Position id. Used to specify the position of the control on the map.
282 * The default position is TOP_RIGHT.
283 */
284 position?: ControlPosition;
285 /** Style id. Used to select what style of map type control to display. */
286 style?: MapTypeControlStyle;
287 }
288
289 enum MapTypeControlStyle {
290 DEFAULT = 0,
291 HORIZONTAL_BAR = 1,
292 DROPDOWN_MENU = 2,
293 INSET = 3,
294 INSET_LARGE = 4,
295 }
296
297 type GestureHandlingOptions = 'cooperative' | 'greedy' | 'none' | 'auto';
298
299 /** Options for the rendering of the pan control. */
300 interface PanControlOptions {
301 /**
302 * Position id. Used to specify the position of the control on the map.
303 * The default position is TOP_LEFT.
304 */
305 position?: ControlPosition;
306 }
307
308 /** Options for the rendering of the rotate control. */
309 interface RotateControlOptions {
310 /**
311 * Position id. Used to specify the position of the control on the map.
312 * The default position is TOP_LEFT.
313 */
314 position?: ControlPosition;
315 }
316
317 /**
318 * A restriction that can be applied to the Map. The map's viewport will not
319 * exceed these restrictions.
320 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction Maps JavaScript API}
321 */
322 interface MapRestriction {
323 /**
324 * When set, a user can only pan and zoom inside the given bounds.
325 * Bounds can restrict both longitude and latitude, or can restrict
326 * latitude only. For latitude-only bounds use west and east longitudes
327 * of -180 and 180, respectively.
328 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction.latLngBounds Maps JavaScript API}
329 */
330 latLngBounds: LatLngBounds | LatLngBoundsLiteral;
331 /**
332 * By default bounds are relaxed, meaning that a user can zoom out
333 * until the entire bounded area is in view. Bounds can be made more
334 * restrictive by setting the strictBounds flag to true. This reduces
335 * how far a user can zoom out, ensuring that everything outside of the
336 * restricted bounds stays hidden.
337 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction.strictBounds Maps JavaScript API}
338 */
339 strictBounds?: boolean;
340 }
341
342 /** Options for the rendering of the scale control. */
343 interface ScaleControlOptions {
344 /** Style id. Used to select what style of scale control to display. */
345 style?: ScaleControlStyle;
346 }
347
348 enum ScaleControlStyle {
349 DEFAULT = 0,
350 }
351
352 /** Options for the rendering of the Street View pegman control on the map. */
353 interface StreetViewControlOptions {
354 /**
355 * Position id. Used to specify the position of the control on the map. The
356 * default position is embedded within the navigation (zoom and pan)
357 * controls. If this position is empty or the same as that specified in the
358 * zoomControlOptions or panControlOptions, the Street View control will be
359 * displayed as part of the navigation controls. Otherwise, it will be
360 * displayed separately.
361 */
362 position?: ControlPosition;
363 }
364
365 /** Options for the rendering of the zoom control. */
366 interface ZoomControlOptions {
367 /**
368 * Position id. Used to specify the position of the control on the map.
369 * The default position is TOP_LEFT.
370 */
371 position?: ControlPosition;
372 style?: ZoomControlStyle;
373 }
374
375 enum ZoomControlStyle {
376 DEFAULT = 0,
377 SMALL = 1,
378 LARGE = 2,
379 }
380
381 /**
382 * Identifiers used to specify the placement of controls on the map. Controls
383 * are positioned relative to other controls in the same layout position.
384 * Controls that are added first are positioned closer to the edge of the map.
385 */
386 enum ControlPosition {
387 /** Elements are positioned in the center of the bottom row. */
388 BOTTOM_CENTER = 11,
389 /**
390 * Elements are positioned in the bottom left and flow towards the middle.
391 * Elements are positioned to the right of the Google logo.
392 */
393 BOTTOM_LEFT = 10,
394 /**
395 * Elements are positioned in the bottom right and flow towards the middle.
396 * Elements are positioned to the left of the copyrights.
397 */
398 BOTTOM_RIGHT = 12,
399 /**
400 * Elements are positioned on the left, above bottom-left elements, and flow
401 * upwards.
402 */
403 LEFT_BOTTOM = 6,
404 /** Elements are positioned in the center of the left side. */
405 LEFT_CENTER = 4,
406 /**
407 * Elements are positioned on the left, below top-left elements, and flow
408 * downwards.
409 */
410 LEFT_TOP = 5,
411 /**
412 * Elements are positioned on the right, above bottom-right elements, and
413 * flow upwards.
414 */
415 RIGHT_BOTTOM = 9,
416 /** Elements are positioned in the center of the right side. */
417 RIGHT_CENTER = 8,
418 /** Elements are positioned on the right, below top-right elements, and flow downwards. */
419 RIGHT_TOP = 7,
420 /** Elements are positioned in the center of the top row. */
421 TOP_CENTER = 2,
422 /** Elements are positioned in the top right and flow towards the middle. */
423 TOP_LEFT = 1,
424 /** Elements are positioned in the top right and flow towards the middle. */
425 TOP_RIGHT = 3,
426 }
427
428 type DrawingMode = 'Point' | 'LineString' | 'Polygon';
429
430 /***** Data *****/
431 class Data extends MVCObject {
432 constructor(options?: Data.DataOptions);
433 add(feature: Data.Feature | Data.FeatureOptions): Data.Feature;
434 addGeoJson(geoJson: object, options?: Data.GeoJsonOptions): Data.Feature[];
435 contains(feature: Data.Feature): boolean;
436 forEach(callback: (feature: Data.Feature) => void): void;
437 getControlPosition(): ControlPosition;
438 getControls(): DrawingMode[];
439 getDrawingMode(): DrawingMode | null;
440 getFeatureById(id: number | string): Data.Feature;
441 getMap(): Map;
442 getStyle(): Data.StylingFunction | Data.StyleOptions;
443 loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void;
444 overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void;
445 remove(feature: Data.Feature): void;
446 revertStyle(feature?: Data.Feature): void;
447 setControlPosition(controlPosition: ControlPosition): void;
448 setControls(controls: DrawingMode[] | null): void;
449 setDrawingMode(drawingMode: DrawingMode | null): void;
450 setMap(map: Map | null): void;
451 setStyle(style: Data.StylingFunction | Data.StyleOptions): void;
452 toGeoJson(callback: (feature: object) => void): void;
453 }
454
455 namespace Data {
456 interface DataOptions {
457 controlPosition?: ControlPosition;
458 controls?: DrawingMode[] | null;
459 drawingMode?: DrawingMode | null;
460 featureFactory?: (geometry: Geometry) => Feature;
461 map?: Map;
462 style?: StylingFunction | StyleOptions;
463 }
464
465 interface GeoJsonOptions {
466 idPropertyName?: string;
467 }
468
469 interface StyleOptions {
470 clickable?: boolean;
471 cursor?: string;
472 draggable?: boolean;
473 editable?: boolean;
474 fillColor?: string;
475 fillOpacity?: number;
476 // tslint:disable-next-line:no-unnecessary-qualifier
477 icon?: string | Icon | google.maps.Symbol;
478 shape?: MarkerShape;
479 strokeColor?: string;
480 strokeOpacity?: number;
481 strokeWeight?: number;
482 title?: string;
483 visible?: boolean;
484 zIndex?: number;
485 }
486
487 type StylingFunction = (feature: Feature) => StyleOptions;
488
489 class Feature {
490 constructor(options?: FeatureOptions);
491 forEachProperty(callback: (value: any, name: string) => void): void;
492 getGeometry(): Geometry;
493 getId(): number | string;
494 getProperty(name: string): any;
495 removeProperty(name: string): void;
496 setGeometry(newGeometry: Geometry | LatLng | LatLngLiteral): void;
497 setProperty(name: string, newValue: any): void;
498 toGeoJson(callback: (feature: object) => void): void;
499 }
500
501 interface FeatureOptions {
502 geometry?: Geometry | LatLng | LatLngLiteral;
503 id?: number | string;
504 properties?: object;
505 }
506
507 class Geometry {
508 getType(): string;
509 forEachLatLng(callback: (latLng: LatLng) => void): void;
510 }
511
512 class Point extends Geometry {
513 constructor(latLng: LatLng | LatLngLiteral);
514 get(): LatLng;
515 }
516
517 class MultiPoint extends Geometry {
518 constructor(elements: Array<LatLng | LatLngLiteral>);
519 getArray(): LatLng[];
520 getAt(n: number): LatLng;
521 getLength(): number;
522 }
523
524 class LineString extends Geometry {
525 constructor(elements: Array<LatLng | LatLngLiteral>);
526 getArray(): LatLng[];
527 getAt(n: number): LatLng;
528 getLength(): number;
529 }
530
531 class MultiLineString extends Geometry {
532 constructor(elements: Array<LineString | Array<LatLng | LatLngLiteral>>);
533 getArray(): LineString[];
534 getAt(n: number): LineString;
535 getLength(): number;
536 }
537
538 class LinearRing extends Geometry {
539 constructor(elements: Array<LatLng | LatLngLiteral>);
540 getArray(): LatLng[];
541 getAt(n: number): LatLng;
542 getLength(): number;
543 }
544
545 class Polygon extends Geometry {
546 constructor(elements: Array<LinearRing | Array<LatLng | LatLngLiteral>>);
547 getArray(): LinearRing[];
548 getAt(n: number): LinearRing;
549 getLength(): number;
550 }
551
552 class MultiPolygon extends Geometry {
553 constructor(elements: Array<Polygon | Array<LinearRing | Array<LatLng | LatLngLiteral>>>);
554 getArray(): Polygon[];
555 getAt(n: number): Polygon;
556 getLength(): number;
557 }
558
559 class GeometryCollection extends Geometry {
560 constructor(elements: Array<Geometry[] | LatLng[] | LatLngLiteral>);
561 getArray(): Geometry[];
562 getAt(n: number): Geometry;
563 getLength(): number;
564 }
565
566 // tslint:disable-next-line:no-unnecessary-qualifier
567 interface MouseEvent extends google.maps.MouseEvent {
568 feature: Feature;
569 }
570
571 interface AddFeatureEvent {
572 feature: Feature;
573 }
574
575 interface RemoveFeatureEvent {
576 feature: Feature;
577 }
578
579 interface SetGeometryEvent {
580 feature: Feature;
581 newGeometry: Geometry;
582 oldGeometry: Geometry;
583 }
584
585 interface SetPropertyEvent {
586 feature: Feature;
587 name: string;
588 newValue: any;
589 oldValue: any;
590 }
591
592 interface RemovePropertyEvent {
593 feature: Feature;
594 name: string;
595 oldValue: any;
596 }
597 }
598
599 /***** Overlays *****/
600
601 type MarkerChangeOptionEventNames =
602 | 'animation_changed'
603 | 'clickable_changed'
604 | 'cursor_changed'
605 | 'draggable_changed'
606 | 'flat_changed'
607 | 'icon_changed'
608 | 'position_changed'
609 | 'shape_changed'
610 | 'title_changed'
611 | 'visible_changed'
612 | 'zindex_changed';
613
614 type MarkerMouseEventNames =
615 | 'click'
616 | 'dblclick'
617 | 'drag'
618 | 'dragend'
619 | 'dragstart'
620 | 'mousedown'
621 | 'mouseout'
622 | 'mouseover'
623 | 'mouseup'
624 | 'rightclick';
625
626 /**
627 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker Maps JavaScript API}
628 */
629 class Marker extends MVCObject {
630 /**
631 * The maximum default `z-index` that the API will assign to a marker. You
632 * may set a higher `z-index` to bring a marker to the front.
633 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.MAX_ZINDEX Maps JavaScript API}
634 */
635 static readonly MAX_ZINDEX: number;
636
637 /**
638 * Creates a marker with the options specified. If a map is specified, the
639 * marker is added to the map upon construction. Note that the position must
640 * be set for the marker to display.
641 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.constructor Maps JavaScript API}
642 */
643 constructor(opts?: ReadonlyMarkerOptions);
644
645 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getAnimation Maps JavaScript API} */
646 getAnimation(): Animation | null | undefined;
647 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getClickable Maps JavaScript API} */
648 getClickable(): boolean;
649 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getCursor Maps JavaScript API} */
650 getCursor(): string | null | undefined;
651 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getDraggable Maps JavaScript API} */
652 getDraggable(): boolean | null | undefined;
653 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getIcon Maps JavaScript API} */
654 getIcon(): string | ReadonlyIcon | ReadonlySymbol | null | undefined;
655 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getLabel Maps JavaScript API} */
656 getLabel(): ReadonlyMarkerLabel | null | undefined;
657 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getMap Maps JavaScript API} */
658 getMap(): Map | StreetViewPanorama | null | undefined;
659 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getOpacity Maps JavaScript API} */
660 getOpacity(): number | null | undefined;
661 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getPosition Maps JavaScript API} */
662 getPosition(): LatLng | null | undefined;
663 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getShape Maps JavaScript API} */
664 getShape(): MarkerShape | null | undefined;
665 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getTitle Maps JavaScript API} */
666 getTitle(): string | null | undefined;
667 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getVisible Maps JavaScript API} */
668 getVisible(): boolean;
669 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.getZIndex Maps JavaScript API} */
670 getZIndex(): number | null | undefined;
671 /**
672 * Start an animation. Any ongoing animation will be cancelled. Currently
673 * supported animations are: {@link Animation.BOUNCE BOUNCE},
674 * {@link Animation.DROP DROP}. Passing in `null` will cause any animation
675 * to stop.
676 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setAnimation Maps JavaScript API}
677 */
678 setAnimation(animation: Animation | null): void;
679 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setClickable Maps JavaScript API} */
680 setClickable(flag: boolean): void;
681 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setCursor Maps JavaScript API} */
682 setCursor(cursor: string | null): void;
683 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setDraggable Maps JavaScript API} */
684 setDraggable(flag: boolean | null): void;
685 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setIcon Maps JavaScript API} */
686 setIcon(icon: string | ReadonlyIcon | ReadonlySymbol | null): void;
687 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setLabel Maps JavaScript API} */
688 setLabel(label: string | ReadonlyMarkerLabel | null): void;
689 /**
690 * Renders the marker on the specified map or panorama. If map is set to
691 * `null`, the marker will be removed.
692 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setMap Maps JavaScript API}
693 */
694 setMap(map: Map | StreetViewPanorama | null): void;
695 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setOpacity Maps JavaScript API} */
696 setOpacity(opacity: number | null): void;
697 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setOptions Maps JavaScript API} */
698 setOptions(options: ReadonlyMarkerOptions): void;
699 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setPosition Maps JavaScript API} */
700 setPosition(latlng: LatLng | ReadonlyLatLngLiteral | null): void;
701 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setShape Maps JavaScript API} */
702 setShape(shape: MarkerShape | null): void;
703 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setTitle Maps JavaScript API} */
704 setTitle(title: string | null): void;
705 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setVisible Maps JavaScript API} */
706 setVisible(visible: boolean): void;
707 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Marker.setZIndex Maps JavaScript API} */
708 setZIndex(zIndex: number | null): void;
709 addListener(eventName: MarkerChangeOptionEventNames, handler: (this: Marker) => void): MapsEventListener;
710 addListener(
711 eventName: MarkerMouseEventNames,
712 handler: (this: Marker, event: MouseEvent) => void,
713 ): MapsEventListener;
714 /** @deprecated */
715 addListener(eventName: string, handler: (this: Marker, ...args: any[]) => void): MapsEventListener;
716 }
717
718 /**
719 * `MarkerOptions` object used to define the properties that can be set on a
720 * {@link Marker}.
721 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions Maps JavaScript API}
722 */
723 interface MarkerOptions {
724 /**
725 * The offset from the marker's position to the tip of an InfoWindow that
726 * has been opened with the marker as anchor.
727 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.anchorPoint Maps JavaScript API}
728 */
729 anchorPoint?: Point;
730 /**
731 * Which animation to play when marker is added to a map.
732 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.animation Maps JavaScript API}
733 */
734 animation?: Animation;
735 /**
736 * If `true`, the marker receives mouse and touch events.
737 * @default true
738 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.clickable Maps JavaScript API}
739 */
740 clickable?: boolean;
741 /**
742 * If `false`, disables cross that appears beneath the marker when dragging.
743 * @default true
744 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.crossOnDrag Maps JavaScript API}
745 */
746 crossOnDrag?: boolean;
747 /**
748 * Mouse cursor to show on hover.
749 * @default 'pointer'
750 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.cursor Maps JavaScript API}
751 * @see {@link CSSStyleDeclaration#cursor}
752 */
753 cursor?: string;
754 /**
755 * If `true`, the marker can be dragged.
756 * @default false
757 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.draggable Maps JavaScript API}
758 */
759 draggable?: boolean;
760 /**
761 * Icon for the foreground. If a `string` is provided, it is treated as
762 * though it were an {@link Icon} with the `string` as {@link Icon#url url}.
763 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.icon Maps JavaScript API}
764 */
765 // tslint:disable-next-line:no-unnecessary-qualifier
766 icon?: string | Icon | google.maps.Symbol;
767 /**
768 * Adds a label to the marker. The label can either be a `string`, or a
769 * {@link MarkerLabel} object.
770 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.label Maps JavaScript API}
771 */
772 label?: string | MarkerLabel;
773 /**
774 * Map on which to display Marker.
775 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.map Maps JavaScript API}
776 */
777 map?: Map | StreetViewPanorama;
778 /**
779 * The marker's opacity between 0.0 and 1.0.
780 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.opacity Maps JavaScript API}
781 * @default 1.0
782 */
783 opacity?: number;
784 /**
785 * Optimization renders many markers as a single static element. Optimized
786 * rendering is enabled by default. Disable optimized rendering for animated
787 * GIFs or PNGs, or when each marker must be rendered as a separate DOM
788 * element (advanced usage only).
789 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.optimized Maps JavaScript API}
790 */
791 optimized?: boolean;
792 /**
793 * Marker position.
794 * **Note that the `position` must be set for the marker to display.**
795 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.position Maps JavaScript API}
796 */
797 position?: LatLng | LatLngLiteral;
798 /**
799 * Image map region definition used for drag/click.
800 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.shape Maps JavaScript API}
801 */
802 shape?: MarkerShape;
803 /**
804 * Rollover text.
805 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.title Maps JavaScript API}
806 * @see {@link HTMLElement#title}
807 */
808 title?: string;
809 /**
810 * If `true`, the marker is visible.
811 * @default true
812 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.visible Maps JavaScript API}
813 */
814 visible?: boolean;
815 /**
816 * All markers are displayed on the map in order of their `zIndex`, with
817 * higher values displaying in front of markers with lower values. By
818 * default, markers are displayed according to their vertical position on
819 * screen, with lower markers appearing in front of markers further up the
820 * screen.
821 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.zIndex Maps JavaScript API}
822 */
823 zIndex?: number;
824 }
825
826 /** @see {@link MarkerOptions} */
827 interface ReadonlyMarkerOptions {
828 /** @see {@link MarkerOptions#anchorPoint} */
829 readonly anchorPoint?: Point;
830 /** @see {@link MarkerOptions#animation} */
831 readonly animation?: Animation;
832 /** @see {@link MarkerOptions#clickable} */
833 readonly clickable?: boolean;
834 /** @see {@link MarkerOptions#crossOnDrag} */
835 readonly crossOnDrag?: boolean;
836 /** @see {@link MarkerOptions#cursor} */
837 readonly cursor?: string;
838 /** @see {@link MarkerOptions#draggable} */
839 readonly draggable?: boolean;
840 /** @see {@link MarkerOptions#icon} */
841 readonly icon?: string | ReadonlyIcon | ReadonlySymbol;
842 /** @see {@link MarkerOptions#label} */
843 readonly label?: string | ReadonlyMarkerLabel;
844 /** @see {@link MarkerOptions#map} */
845 readonly map?: Map | StreetViewPanorama;
846 /** @see {@link MarkerOptions#opacity} */
847 readonly opacity?: number;
848 /** @see {@link MarkerOptions#optimized} */
849 readonly optimized?: boolean;
850 /** @see {@link MarkerOptions#place} */
851 readonly place?: Place;
852 /** @see {@link MarkerOptions#position} */
853 readonly position?: LatLng | ReadonlyLatLngLiteral;
854 /** @see {@link MarkerOptions#shape} */
855 readonly shape?: MarkerShape;
856 /** @see {@link MarkerOptions#title} */
857 readonly title?: string;
858 /** @see {@link MarkerOptions#visible} */
859 readonly visible?: boolean;
860 /** @see {@link MarkerOptions#zIndex} */
861 readonly zIndex?: number;
862 }
863
864 /**
865 * A structure representing a Marker icon image.
866 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon Maps JavaScript API}
867 */
868 interface Icon {
869 /**
870 * The position at which to anchor an image in correspondence to the
871 * location of the marker on the map. By default, the anchor is located
872 * along the center point of the bottom of the image.
873 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.anchor Maps JavaScript API}
874 */
875 anchor?: Point;
876 /**
877 * The origin of the label relative to the top-left corner of the icon
878 * image, if a label is supplied by the marker. By default, the origin is
879 * located in the center point of the image.
880 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.labelOrigin Maps JavaScript API}
881 */
882 labelOrigin?: Point;
883 /**
884 * The position of the image within a sprite, if any.
885 * @default new google.maps.Point(0, 0)
886 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.origin Maps JavaScript API}
887 */
888 origin?: Point;
889 /**
890 * The size of the entire image after scaling, if any. Use this property to
891 * stretch/shrink an image or a sprite.
892 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.scaledSize Maps JavaScript API}
893 */
894 scaledSize?: Size;
895 /**
896 * The display size of the sprite or image. When using sprites, you must
897 * specify the sprite size. If the size is not provided, it will be set when
898 * the image loads.
899 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.size Maps JavaScript API}
900 */
901 size?: Size;
902 /**
903 * The URL of the image or sprite sheet.
904 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Icon.url Maps JavaScript API}
905 */
906 url: string;
907 }
908
909 /** @see {@link Icon} */
910 interface ReadonlyIcon {
911 /** @see {@link Icon#anchor} */
912 readonly anchor?: Point;
913 /** @see {@link Icon#labelOrigin} */
914 readonly labelOrigin?: Point;
915 /** @see {@link Icon#origin} */
916 readonly origin?: Point;
917 /** @see {@link Icon#scaledSize} */
918 readonly scaledSize?: Size;
919 /** @see {@link Icon#size} */
920 readonly size?: Size;
921 /** @see {@link Icon#url} */
922 readonly url: string;
923 }
924
925 /**
926 * These options specify the appearance of a marker label. A marker label is a
927 * single character of text which will appear inside the marker. If you are
928 * using it with a custom marker, you can reposition it with the
929 * {@link Icon#labelOrigin labelOrigin} property in the {@link Icon} class.
930 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel Maps JavaScript API}
931 */
932 interface MarkerLabel {
933 /**
934 * The color of the label text.
935 * @default 'black'
936 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel.color Maps JavaScript API}
937 * @see {@link CSSStyleDeclaration#color}
938 */
939 color?: string;
940 /**
941 * The font family of the label text.
942 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel.fontFamily Maps JavaScript API}
943 * @see {@link CSSStyleDeclaration#fontFamily}
944 */
945 fontFamily?: string;
946 /**
947 * The font size of the label text.
948 * @default '14px'
949 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel.fontSize Maps JavaScript API}
950 * @see {@link CSSStyleDeclaration#fontSize}
951 */
952 fontSize?: string;
953 /**
954 * The font weight of the label text.
955 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel.fontWeight Maps JavaScript API}
956 * @see {@link CSSStyleDeclaration#fontWeight}
957 */
958 fontWeight?: string;
959 /**
960 * The text to be displayed in the label.
961 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerLabel.text Maps JavaScript API}
962 */
963 text: string;
964 }
965
966 /** @see {@link MarkerLabel} */
967 interface ReadonlyMarkerLabel {
968 /** @see {@link MarkerLabel#color} */
969 color?: string;
970 /** @see {@link MarkerLabel#fontFamily} */
971 fontFamily?: string;
972 /** @see {@link MarkerLabel#fontSize} */
973 fontSize?: string;
974 /** @see {@link MarkerLabel#fontWeight} */
975 fontWeight?: string;
976 /** @see {@link MarkerLabel#text} */
977 text: string;
978 }
979
980 interface MarkerShapePolyCoords extends Array<number> {
981 0: number;
982 1: number;
983 2: number;
984 3: number;
985 }
986
987 interface MarkerShapeCircle {
988 type: 'circle';
989 /**
990 * Coords is **[x1,y1,r]** where x1,y2 are the coordinates of the center of
991 * the circle, and r is the radius of the circle.
992 */
993 coords: [number, number, number];
994 }
995
996 interface MarkerShapeRect {
997 type: 'rect';
998 /**
999 * Coords is **[x1,y1,x2,y2]** where x1,y1 are the coordinates of the
1000 * upper-left corner of the rectangle and x2,y2 are the coordinates of the
1001 * lower-right coordinates of the rectangle.
1002 */
1003 coords: [number, number, number, number];
1004 }
1005
1006 interface MarkerShapePoly {
1007 type: 'poly';
1008 /**
1009 * Coords is **[x1,y1,x2,y2...xn,yn]** where each x,y pair contains the
1010 * coordinates of one vertex of the polygon.
1011 */
1012 coords: MarkerShapePolyCoords;
1013 }
1014
1015 /**
1016 * This object defines the clickable region of a marker image. The shape
1017 * consists of two properties — `type` and `coord` — which define the
1018 * non-transparent region of an image.
1019 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerShape Maps JavaScript API}
1020 */
1021 type MarkerShape = MarkerShapeCircle | MarkerShapeRect | MarkerShapePoly;
1022
1023 /**
1024 * Describes a symbol, which consists of a vector path with styling. A symbol
1025 * can be used as the icon of a marker, or placed on a polyline.
1026 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol Maps JavaScript API}
1027 */
1028 interface Symbol {
1029 /**
1030 * The position of the symbol relative to the marker or polyline. The
1031 * coordinates of the symbol's path are translated left and up by the
1032 * anchor's x and y coordinates respectively. The position is expressed in
1033 * the same coordinate system as the symbol's path.
1034 * @default new google.maps.Point(0, 0)
1035 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.anchor Maps JavaScript API}
1036 */
1037 anchor?: Point;
1038 /**
1039 * The symbol's fill color. All CSS3 colors are supported except for
1040 * extended named colors. For symbol markers, this defaults to 'black'.
1041 * For symbols on polylines, this defaults to the stroke color of the
1042 * corresponding polyline.
1043 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.fillColor Maps JavaScript API}
1044 */
1045 fillColor?: string;
1046 /**
1047 * The symbol's fill opacity.
1048 * @default 1
1049 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.fillOpacity Maps JavaScript API}
1050 */
1051 fillOpacity?: number;
1052 /**
1053 * The origin of the label relative to the origin of the path, if label is
1054 * supplied by the marker. The origin is expressed in the same coordinate
1055 * system as the symbol's path. This property is unused for symbols on
1056 * polylines.
1057 * @default new google.maps.Point(0, 0)
1058 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.labelOrigin Maps JavaScript API}
1059 */
1060 labelOrigin?: Point;
1061 /**
1062 * The symbol's path, which is a built-in symbol path, or a custom path
1063 * expressed using
1064 * {@link http://www.w3.org/TR/SVG/paths.html#PathData SVG path notation}.
1065 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.path Maps JavaScript API}
1066 */
1067 path: SymbolPath | string;
1068 /**
1069 * The angle by which to rotate the symbol, expressed clockwise in degrees.
1070 * A symbol in an {@link IconSequence} where
1071 * {@link IconSequence#fixedRotation fixedRotation} is false is rotated
1072 * relative to the angle of the edge on which it lies.
1073 * @default 0
1074 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.rotation Maps JavaScript API}
1075 */
1076 rotation?: number;
1077 /**
1078 * The amount by which the symbol is scaled in size. For symbol markers,
1079 * this defaults to 1; after scaling, the symbol may be of any size. For
1080 * symbols on a polyline, this defaults to the stroke weight of the
1081 * polyline; after scaling, the symbol must lie inside a square 22 pixels in
1082 * size centered at the symbol's anchor.
1083 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.scale Maps JavaScript API}
1084 */
1085 scale?: number;
1086 /**
1087 * The symbol's stroke color. All CSS3 colors are supported except for
1088 * extended named colors. For symbol markers, this defaults to 'black'. For
1089 * symbols on a polyline, this defaults to the stroke color of the polyline.
1090 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.strokeColor Maps JavaScript API}
1091 */
1092 strokeColor?: string;
1093 /**
1094 * The symbol's stroke opacity. For symbol markers, this defaults to 1. For
1095 * symbols on a polyline, this defaults to the stroke opacity of the
1096 * polyline.
1097 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.strokeOpacity Maps JavaScript API}
1098 */
1099 strokeOpacity?: number;
1100 /**
1101 * The symbol's stroke weight. Defaults to the scale of the symbol.
1102 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Symbol.strokeWeight Maps JavaScript API}
1103 */
1104 strokeWeight?: number;
1105 }
1106
1107 /** @see {@link Symbol} */
1108 interface ReadonlySymbol {
1109 /** @see {@link Symbol#anchor} */
1110 readonly anchor?: Point;
1111 /** @see {@link Symbol#fillColor} */
1112 readonly fillColor?: string;
1113 /** @see {@link Symbol#fillOpacity} */
1114 readonly fillOpacity?: number;
1115 /** @see {@link Symbol#labelOrigin} */
1116 readonly labelOrigin?: Point;
1117 /** @see {@link Symbol#path} */
1118 readonly path: SymbolPath | string;
1119 /** @see {@link Symbol#rotation} */
1120 readonly rotation?: number;
1121 /** @see {@link Symbol#scale} */
1122 readonly scale?: number;
1123 /** @see {@link Symbol#strokeColor} */
1124 readonly strokeColor?: string;
1125 /** @see {@link Symbol#strokeOpacity} */
1126 readonly strokeOpacity?: number;
1127 /** @see {@link Symbol#strokeWeight} */
1128 readonly strokeWeight?: number;
1129 }
1130
1131 /**
1132 * Built-in symbol paths.
1133 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath Maps JavaScript API}
1134 */
1135 enum SymbolPath {
1136 /**
1137 * A backward-pointing closed arrow.
1138 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath.BACKWARD_CLOSED_ARROW Maps JavaScript API}
1139 */
1140 BACKWARD_CLOSED_ARROW = 3,
1141 /**
1142 * A backward-pointing open arrow.
1143 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath.BACKWARD_OPEN_ARROW Maps JavaScript API}
1144 */
1145 BACKWARD_OPEN_ARROW = 4,
1146 /**
1147 * A circle.
1148 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath.CIRCLE Maps JavaScript API}
1149 */
1150 CIRCLE = 0,
1151 /**
1152 * A forward-pointing closed arrow.
1153 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath.FORWARD_CLOSED_ARROW Maps JavaScript API}
1154 */
1155 FORWARD_CLOSED_ARROW = 1,
1156 /**
1157 * A forward-pointing open arrow.
1158 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#SymbolPath.FORWARD_OPEN_ARROW Maps JavaScript API}
1159 */
1160 FORWARD_OPEN_ARROW = 2,
1161 }
1162
1163 /**
1164 * Animations that can be played on a marker. Use the
1165 * {@link Marker#setAnimation setAnimation} method on Marker or the
1166 * {@link MarkerOptions#animation animation} option to play an animation.
1167 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Animation Maps JavaScript API}
1168 */
1169 enum Animation {
1170 /**
1171 * Marker bounces until animation is stopped.
1172 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Animation.BOUNCE Maps JavaScript API}
1173 */
1174 BOUNCE = 1,
1175 /**
1176 * Marker falls from the top of the map ending with a small bounce.
1177 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/marker#Animation.DROP Maps JavaScript API}
1178 */
1179 DROP = 2,
1180 }
1181
1182 /**
1183 * An overlay that looks like a bubble and is often connected to a marker.
1184 * This class extends MVCObject.
1185 */
1186 class InfoWindow extends MVCObject {
1187 /**
1188 * Creates an info window with the given options. An InfoWindow can be
1189 * placed on a map at a particular position or above a marker,
1190 * depending on what is specified in the options. Unless auto-pan is
1191 * disabled, an InfoWindow will pan the map to make itself visible
1192 * when it is opened. After constructing an InfoWindow, you must call
1193 * open to display it on the map. The user can click the close button
1194 * on the InfoWindow to remove it from the map, or the developer can
1195 * call close() for the same effect.
1196 */
1197 constructor(opts?: InfoWindowOptions);
1198 /** Closes this InfoWindow by removing it from the DOM structure. */
1199 close(): void;
1200 getContent(): string | Element;
1201 getPosition(): LatLng;
1202 getZIndex(): number;
1203 /**
1204 * Opens this InfoWindow on the given map. Optionally, an InfoWindow can be
1205 * associated with an anchor. In the core API, the only anchor is the Marker
1206 * class. However, an anchor can be any MVCObject that exposes a LatLng
1207 * position property and optionally a Point anchorPoint property for
1208 * calculating the pixelOffset (see InfoWindowOptions). The anchorPoint is
1209 * the offset from the anchor's position to the tip of the InfoWindow.
1210 */
1211 open(map?: Map | StreetViewPanorama, anchor?: MVCObject): void;
1212 setContent(content: string | Node): void;
1213 setOptions(options: InfoWindowOptions): void;
1214 setPosition(position: LatLng | LatLngLiteral): void;
1215 setZIndex(zIndex: number): void;
1216 }
1217
1218 interface InfoWindowOptions {
1219 /**
1220 * Content to display in the InfoWindow. This can be an HTML element, a
1221 * plain-text string, or a string containing HTML. The InfoWindow will be
1222 * sized according to the content. To set an explicit size for the content,
1223 * set content to be a HTML element with that size.
1224 */
1225 content?: string | Node;
1226 /**
1227 * Disable auto-pan on open. By default, the info window will pan the map so
1228 * that it is fully visible when it opens.
1229 */
1230 disableAutoPan?: boolean;
1231 /**
1232 * Maximum width of the infowindow, regardless of content's width.
1233 * This value is only considered if it is set before a call to open.
1234 * To change the maximum width when changing content, call close,
1235 * setOptions, and then open.
1236 */
1237 maxWidth?: number;
1238 /**
1239 * The offset, in pixels, of the tip of the info window from the point on
1240 * the map at whose geographical coordinates the info window is anchored. If
1241 * an InfoWindow is opened with an anchor, the pixelOffset will be
1242 * calculated from the anchor's anchorPoint property.
1243 */
1244 pixelOffset?: Size;
1245 /**
1246 * The LatLng at which to display this InfoWindow. If the InfoWindow is
1247 * opened with an anchor, the anchor's position will be used instead.
1248 */
1249 position?: LatLng | LatLngLiteral;
1250 /**
1251 * All InfoWindows are displayed on the map in order of their zIndex,
1252 * with higher values displaying in front of InfoWindows with lower values.
1253 * By default, InfoWindows are displayed according to their latitude,
1254 * with InfoWindows of lower latitudes appearing in front of InfoWindows at
1255 * higher latitudes. InfoWindows are always displayed in front of markers.
1256 */
1257 zIndex?: number;
1258 }
1259
1260 class Polyline extends MVCObject {
1261 constructor(opts?: PolylineOptions);
1262 getDraggable(): boolean;
1263 getEditable(): boolean;
1264 getMap(): Map;
1265 getPath(): MVCArray<LatLng>;
1266 getVisible(): boolean;
1267 setDraggable(draggable: boolean): void;
1268 setEditable(editable: boolean): void;
1269 setMap(map: Map | null): void;
1270 setOptions(options: PolylineOptions): void;
1271 setPath(path: MVCArray<LatLng> | LatLng[] | LatLngLiteral[]): void;
1272 setVisible(visible: boolean): void;
1273 }
1274
1275 interface PolylineOptions {
1276 /**
1277 * Indicates whether this Polyline handles mouse events. Defaults to true.
1278 */
1279 clickable?: boolean;
1280 /**
1281 * If set to true, the user can drag this shape over the map.
1282 * The geodesic property defines the mode of dragging. Defaults to false.
1283 */
1284 draggable?: boolean;
1285 /**
1286 * If set to true, the user can edit this shape by dragging the control
1287 * points shown at the vertices and on each segment. Defaults to false.
1288 */
1289 editable?: boolean;
1290 /**
1291 * When true, edges of the polygon are interpreted as geodesic and will
1292 * follow the curvature of the Earth. When false, edges of the polygon are
1293 * rendered as straight lines in screen space. Note that the shape of a
1294 * geodesic polygon may appear to change when dragged, as the dimensions are
1295 * maintained relative to the surface of the earth. Defaults to false.
1296 */
1297 geodesic?: boolean;
1298 /** The icons to be rendered along the polyline. */
1299 icons?: IconSequence[];
1300 /** Map on which to display Polyline. */
1301 map?: Map;
1302 /**
1303 * The ordered sequence of coordinates of the Polyline.
1304 * This path may be specified using either a simple array of LatLngs, or an
1305 * MVCArray of LatLngs. Note that if you pass a simple array, it will be
1306 * converted to an MVCArray Inserting or removing LatLngs in the MVCArray
1307 * will automatically update the polyline on the map.
1308 */
1309 path?: MVCArray<LatLng> | LatLng[] | LatLngLiteral[];
1310 /**
1311 * The stroke color. All CSS3 colors are supported except for extended
1312 * named colors.
1313 */
1314 strokeColor?: string;
1315 /** The stroke opacity between 0.0 and 1.0. */
1316 strokeOpacity?: number;
1317 /** The stroke width in pixels. */
1318 strokeWeight?: number;
1319 /** Whether this polyline is visible on the map. Defaults to true. */
1320 visible?: boolean;
1321 /** The zIndex compared to other polys. */
1322 zIndex?: number;
1323 }
1324
1325 interface IconSequence {
1326 fixedRotation?: boolean;
1327 // tslint:disable-next-line:no-unnecessary-qualifier
1328 icon?: google.maps.Symbol;
1329 offset?: string;
1330 repeat?: string;
1331 }
1332
1333 class Polygon extends MVCObject {
1334 constructor(opts?: PolygonOptions);
1335 getDraggable(): boolean;
1336 getEditable(): boolean;
1337 getMap(): Map;
1338 /** Retrieves the first path. */
1339 getPath(): MVCArray<LatLng>;
1340 /** Retrieves the paths for this polygon. */
1341 getPaths(): MVCArray<MVCArray<LatLng>>;
1342 getVisible(): boolean;
1343 setDraggable(draggable: boolean): void;
1344 setEditable(editable: boolean): void;
1345 setMap(map: Map | null): void;
1346 setOptions(options: PolygonOptions): void;
1347 setPath(path: MVCArray<LatLng> | LatLng[] | LatLngLiteral[]): void;
1348 setPaths(
1349 paths:
1350 | MVCArray<MVCArray<LatLng>>
1351 | MVCArray<LatLng>
1352 | LatLng[][]
1353 | LatLngLiteral[][]
1354 | LatLng[]
1355 | LatLngLiteral[],
1356 ): void;
1357 setVisible(visible: boolean): void;
1358 }
1359
1360 interface PolygonOptions {
1361 /**
1362 * Indicates whether this Polygon handles mouse events. Defaults to true.
1363 */
1364 clickable?: boolean;
1365 /**
1366 * If set to true, the user can drag this shape over the map.
1367 * The geodesic property defines the mode of dragging. Defaults to false.
1368 */
1369 draggable?: boolean;
1370 /**
1371 * If set to true, the user can edit this shape by dragging the control
1372 * points shown at the vertices and on each segment. Defaults to false.
1373 */
1374 editable?: boolean;
1375 /**
1376 * The fill color. All CSS3 colors are supported except for extended named
1377 * colors.
1378 */
1379 fillColor?: string;
1380 /** The fill opacity between 0.0 and 1.0 */
1381 fillOpacity?: number;
1382 /**
1383 * When true, edges of the polygon are interpreted as geodesic and will
1384 * follow the curvature of the Earth. When false, edges of the polygon are
1385 * rendered as straight lines in screen space. Note that the shape of a
1386 * geodesic polygon may appear to change when dragged, as the dimensions are
1387 * maintained relative to the surface of the earth. Defaults to false.
1388 */
1389 geodesic?: boolean;
1390 /** Map on which to display Polygon. */
1391 map?: Map;
1392 /**
1393 * The ordered sequence of coordinates that designates a closed loop. Unlike
1394 * polylines, a polygon may consist of one or more paths. As a result, the
1395 * paths property may specify one or more arrays of LatLng coordinates.
1396 * Paths are closed automatically; do not repeat the first vertex of the
1397 * path as the last vertex. Simple polygons may be defined using a single
1398 * array of LatLngs. More complex polygons may specify an array of arrays.
1399 * Any simple arrays are converted into MVCArrays. Inserting or removing
1400 * LatLngs from the MVCArray will automatically update the polygon on the
1401 * map.
1402 */
1403 paths?:
1404 | MVCArray<MVCArray<LatLng>>
1405 | MVCArray<LatLng>
1406 | LatLng[][]
1407 | LatLngLiteral[][]
1408 | LatLng[]
1409 | LatLngLiteral[];
1410 /**
1411 * The stroke color.
1412 * All CSS3 colors are supported except for extended named colors.
1413 */
1414 strokeColor?: string;
1415 /** The stroke opacity between 0.0 and 1.0 */
1416 strokeOpacity?: number;
1417 /**
1418 * The stroke position. Defaults to CENTER.
1419 * This property is not supported on Internet Explorer 8 and earlier.
1420 */
1421 strokePosition?: StrokePosition;
1422 /** The stroke width in pixels. */
1423 strokeWeight?: number;
1424 /** Whether this polygon is visible on the map. Defaults to true. */
1425 visible?: boolean;
1426 /** The zIndex compared to other polys. */
1427 zIndex?: number;
1428 }
1429
1430 interface PolyMouseEvent extends MouseEvent {
1431 edge?: number;
1432 path?: number;
1433 vertex?: number;
1434 }
1435
1436 class Rectangle extends MVCObject {
1437 constructor(opts?: RectangleOptions);
1438 getBounds(): LatLngBounds;
1439 getDraggable(): boolean;
1440 getEditable(): boolean;
1441 getMap(): Map;
1442 getVisible(): boolean;
1443 setBounds(bounds: LatLngBounds | LatLngBoundsLiteral): void;
1444 setDraggable(draggable: boolean): void;
1445 setEditable(editable: boolean): void;
1446 setMap(map: Map | null): void;
1447 setOptions(options: RectangleOptions): void;
1448 setVisible(visible: boolean): void;
1449 }
1450
1451 interface RectangleOptions {
1452 bounds?: LatLngBounds | LatLngBoundsLiteral;
1453 clickable?: boolean;
1454 draggable?: boolean;
1455 editable?: boolean;
1456 fillColor?: string;
1457 fillOpacity?: number;
1458 map?: Map;
1459 strokeColor?: string;
1460 strokeOpacity?: number;
1461 strokePosition?: StrokePosition;
1462 strokeWeight?: number;
1463 visible?: boolean;
1464 zIndex?: number;
1465 }
1466
1467 /** A circle on the Earth's surface; also known as a "spherical cap". */
1468 class Circle extends MVCObject {
1469 /**
1470 * Create a circle using the passed CircleOptions, which specify the
1471 * center, radius, and style.
1472 */
1473 constructor(opts?: CircleOptions);
1474 /** Gets the LatLngBounds of this Circle. */
1475 getBounds(): LatLngBounds;
1476 /** Returns the center of this circle. */
1477 getCenter(): LatLng;
1478 /** Returns whether this circle can be dragged by the user. */
1479 getDraggable(): boolean;
1480 /** Returns whether this circle can be edited by the user. */
1481 getEditable(): boolean;
1482 /** Returns the map on which this circle is displayed. */
1483 getMap(): Map;
1484 /** Returns the radius of this circle (in meters). */
1485 getRadius(): number;
1486 /** Returns whether this circle is visible on the map. */
1487 getVisible(): boolean;
1488 /** Sets the center of this circle. */
1489 setCenter(center: LatLng | LatLngLiteral): void;
1490 /** If set to true, the user can drag this circle over the map. */
1491 setDraggable(draggable: boolean): void;
1492 /**
1493 * If set to true, the user can edit this circle by dragging the control
1494 * points shown at the center and around the circumference of the circle.
1495 */
1496 setEditable(editable: boolean): void;
1497 /**
1498 * Renders the circle on the specified map. If map is set to null, the
1499 * circle will be removed.
1500 */
1501 setMap(map: Map | null): void;
1502 setOptions(options: CircleOptions): void;
1503 /** Sets the radius of this circle (in meters). */
1504 setRadius(radius: number): void;
1505 /** Hides this circle if set to false. */
1506 setVisible(visible: boolean): void;
1507 }
1508
1509 interface CircleOptions {
1510 /** The center */
1511 center?: LatLng | LatLngLiteral;
1512 /** Indicates whether this Circle handles mouse events. Defaults to true. */
1513 clickable?: boolean;
1514 /**
1515 * If set to true, the user can drag this circle over the map. Defaults to
1516 * false.
1517 */
1518 draggable?: boolean;
1519 /**
1520 * If set to true, the user can edit this circle by dragging the control
1521 * points shown at the center and around the circumference of the circle.
1522 * Defaults to false.
1523 */
1524 editable?: boolean;
1525 /**
1526 * The fill color. All CSS3 colors are supported except for extended named
1527 * colors.
1528 */
1529 fillColor?: string;
1530 /** The fill opacity between 0.0 and 1.0 */
1531 fillOpacity?: number;
1532 /** Map on which to display Circle. */
1533 map?: Map;
1534 /** The radius in meters on the Earth's surface */
1535 radius?: number;
1536 /**
1537 * The stroke color. All CSS3 colors are supported except for extended
1538 * named colors.
1539 */
1540 strokeColor?: string;
1541 /** The stroke opacity between 0.0 and 1.0 */
1542 strokeOpacity?: number;
1543 /**
1544 * The stroke position. Defaults to CENTER. This property is not supported
1545 * on Internet Explorer 8 and earlier.
1546 */
1547 strokePosition?: StrokePosition;
1548 /** The stroke width in pixels. */
1549 strokeWeight?: number;
1550 /** Whether this circle is visible on the map. Defaults to true. */
1551 visible?: boolean;
1552 /** The zIndex compared to other polys. */
1553 zIndex?: number;
1554 }
1555
1556 interface CircleLiteral extends CircleOptions {
1557 /** The center of the Circle. */
1558 center?: LatLng | LatLngLiteral;
1559 /** The radius in meters on the Earth's surface. */
1560 radius?: number;
1561 }
1562
1563 /**
1564 * The possible positions of the stroke on a polygon.
1565 */
1566 enum StrokePosition {
1567 /**
1568 * The stroke is centered on the polygon's path, with half the stroke inside
1569 * the polygon and half the stroke outside the polygon.
1570 */
1571 CENTER = 0,
1572 /** The stroke lies inside the polygon. */
1573 INSIDE = 1,
1574 /** The stroke lies outside the polygon. */
1575 OUTSIDE = 2,
1576 }
1577
1578 class GroundOverlay extends MVCObject {
1579 constructor(url: string, bounds: LatLngBounds | LatLngBoundsLiteral, opts?: GroundOverlayOptions);
1580 getBounds(): LatLngBounds;
1581 getMap(): Map;
1582 getOpacity(): number;
1583 getUrl(): string;
1584 setMap(map: Map | null): void;
1585 setOpacity(opacity: number): void;
1586 }
1587
1588 interface GroundOverlayOptions {
1589 clickable?: boolean;
1590 map?: Map;
1591 opacity?: number;
1592 }
1593
1594 class OverlayView extends MVCObject {
1595 draw(): void;
1596 getMap(): Map | StreetViewPanorama;
1597 getPanes(): MapPanes;
1598 getProjection(): MapCanvasProjection;
1599 onAdd(): void;
1600 onRemove(): void;
1601 setMap(map: Map | StreetViewPanorama | null): void;
1602 }
1603
1604 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes Maps JavaScript API} */
1605 interface MapPanes {
1606 /**
1607 * This pane contains the info window. (Pane 4).
1608 * It is above all map overlays.
1609 * @see {@link overlayMouseTarget pane below}
1610 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes.floatPane Maps JavaScript API}
1611 */
1612 readonly floatPane: Element;
1613
1614 /**
1615 * This pane is the lowest pane and is above the tiles. (Pane 0).
1616 * It may not receive DOM events.
1617 * @see {@link overlayLayer pane above}
1618 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes.mapPane Maps JavaScript API}
1619 */
1620 readonly mapPane: Element;
1621
1622 /**
1623 * This pane contains markers. (Pane 2).
1624 * It may not receive DOM events.
1625 * @see {@link floatPane pane above}
1626 * @see {@link overlayLayer pane below}
1627 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes.markerLayer Maps JavaScript API}
1628 */
1629 readonly markerLayer: Element;
1630
1631 /**
1632 * This pane contains polylines, polygons, ground overlays and tile layer overlays. (Pane 1).
1633 * It may not receive DOM events.
1634 * @see {@link markerLayer pane above}
1635 * @see {@link mapPane pane below}
1636 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes.overlayLayer Maps JavaScript API}
1637 */
1638 readonly overlayLayer: Element;
1639
1640 /**
1641 * This pane contains elements that receive DOM events. (Pane 3).
1642 * @see {@link floatPane pane above}
1643 * @see {@link markerLayer pane below}
1644 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes.overlayMouseTarget Maps JavaScript API}
1645 */
1646 readonly overlayMouseTarget: Element;
1647 }
1648
1649 class MapCanvasProjection extends MVCObject {
1650 fromContainerPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
1651 fromDivPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
1652 fromLatLngToContainerPixel(latLng: LatLng): Point;
1653 fromLatLngToDivPixel(latLng: LatLng): Point;
1654 getWorldWidth(): number;
1655 }
1656
1657 /***** Services *****/
1658 class Geocoder {
1659 geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void): void;
1660 }
1661
1662 interface GeocoderRequest {
1663 address?: string;
1664 bounds?: LatLngBounds | LatLngBoundsLiteral;
1665 componentRestrictions?: GeocoderComponentRestrictions;
1666 location?: LatLng | LatLngLiteral;
1667 placeId?: string;
1668 region?: string;
1669 }
1670
1671 interface GeocoderComponentRestrictions {
1672 administrativeArea?: string;
1673 country?: string | string[];
1674 locality?: string;
1675 postalCode?: string;
1676 route?: string;
1677 }
1678
1679 enum GeocoderStatus {
1680 ERROR = 'ERROR',
1681 INVALID_REQUEST = 'INVALID_REQUEST',
1682 OK = 'OK',
1683 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
1684 REQUEST_DENIED = 'REQUEST_DENIED',
1685 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
1686 ZERO_RESULTS = 'ZERO_RESULTS',
1687 }
1688
1689 interface GeocoderResult {
1690 address_components: GeocoderAddressComponent[];
1691 formatted_address: string;
1692 geometry: GeocoderGeometry;
1693 partial_match: boolean;
1694 place_id: string;
1695 postcode_localities: string[];
1696 types: string[];
1697 }
1698
1699 interface GeocoderAddressComponent {
1700 long_name: string;
1701 short_name: string;
1702 types: string[];
1703 }
1704
1705 interface GeocoderGeometry {
1706 bounds: LatLngBounds;
1707 location: LatLng;
1708 location_type: GeocoderLocationType;
1709 viewport: LatLngBounds;
1710 }
1711
1712 enum GeocoderLocationType {
1713 APPROXIMATE = 'APPROXIMATE',
1714 GEOMETRIC_CENTER = 'GEOMETRIC_CENTER',
1715 RANGE_INTERPOLATED = 'RANGE_INTERPOLATED',
1716 ROOFTOP = 'ROOFTOP',
1717 }
1718
1719 class DirectionsRenderer extends MVCObject {
1720 constructor(opts?: DirectionsRendererOptions);
1721 getDirections(): DirectionsResult;
1722 getMap(): Map;
1723 getPanel(): Element;
1724 getRouteIndex(): number;
1725 setDirections(directions: DirectionsResult): void;
1726 setMap(map: Map | null): void;
1727 setOptions(options: DirectionsRendererOptions): void;
1728 setPanel(panel: Element): void;
1729 setRouteIndex(routeIndex: number): void;
1730 }
1731
1732 interface DirectionsRendererOptions {
1733 directions?: DirectionsResult;
1734 draggable?: boolean;
1735 hideRouteList?: boolean;
1736 infoWindow?: InfoWindow;
1737 map?: Map;
1738 markerOptions?: MarkerOptions;
1739 panel?: Element;
1740 polylineOptions?: PolylineOptions;
1741 preserveViewport?: boolean;
1742 routeIndex?: number;
1743 suppressBicyclingLayer?: boolean;
1744 suppressInfoWindows?: boolean;
1745 suppressMarkers?: boolean;
1746 suppressPolylines?: boolean;
1747 }
1748
1749 class DirectionsService {
1750 route(request: DirectionsRequest, callback: (result: DirectionsResult, status: DirectionsStatus) => void): void;
1751 }
1752
1753 /** A directions query to be sent to the DirectionsService. */
1754 interface DirectionsRequest {
1755 /**
1756 * If true, instructs the Directions service to avoid ferries where
1757 * possible. Optional.
1758 */
1759 avoidFerries?: boolean;
1760 /**
1761 * If true, instructs the Directions service to avoid highways where
1762 * possible. Optional.
1763 */
1764 avoidHighways?: boolean;
1765 /**
1766 * If true, instructs the Directions service to avoid toll roads where
1767 * possible. Optional.
1768 */
1769 avoidTolls?: boolean;
1770 /**
1771 * Location of destination. This can be specified as either a string to be
1772 * geocoded, or a LatLng, or a Place. Required.
1773 */
1774 destination?: string | LatLng | LatLngLiteral | Place;
1775 /** Deprecated. Use drivingOptions field instead */
1776 durationInTraffic?: boolean;
1777 /**
1778 * Settings that apply only to requests where travelMode is DRIVING. This
1779 * object will have no effect for other travel modes.
1780 */
1781 drivingOptions?: DrivingOptions;
1782 /**
1783 * If set to true, the DirectionService will attempt to re-order the
1784 * supplied intermediate waypoints to minimize overall cost of the route. If
1785 * waypoints are optimized, inspect DirectionsRoute.waypoint_order in the
1786 * response to determine the new ordering.
1787 */
1788 optimizeWaypoints?: boolean;
1789 /**
1790 * Location of origin. This can be specified as either a string to be
1791 * geocoded, or a LatLng, or a Place. Required.
1792 */
1793 origin?: string | LatLng | LatLngLiteral | Place;
1794 /** Whether or not route alternatives should be provided. Optional. */
1795 provideRouteAlternatives?: boolean;
1796 /** Region code used as a bias for geocoding requests. Optional. */
1797 region?: string;
1798 /**
1799 * Settings that apply only to requests where travelMode is TRANSIT. This
1800 * object will have no effect for other travel modes.
1801 */
1802 transitOptions?: TransitOptions;
1803 /** Type of routing requested. Required. */
1804 travelMode?: TravelMode;
1805 /**
1806 * Preferred unit system to use when displaying distance. Defaults to the
1807 * unit system used in the country of origin.
1808 */
1809 unitSystem?: UnitSystem;
1810 /**
1811 * Array of intermediate waypoints. Directions will be calculated from the
1812 * origin to the destination by way of each waypoint in this array. The
1813 * maximum allowed waypoints is 8, plus the origin, and destination. Premium
1814 * Plan customers are allowed 23 waypoints, plus the origin, and
1815 * destination. Waypoints are not supported for transit directions.
1816 * Optional.
1817 */
1818 waypoints?: DirectionsWaypoint[];
1819 }
1820
1821 enum TravelMode {
1822 BICYCLING = 'BICYCLING',
1823 DRIVING = 'DRIVING',
1824 TRANSIT = 'TRANSIT',
1825 TWO_WHEELER = 'TWO_WHEELER',
1826 WALKING = 'WALKING',
1827 }
1828
1829 enum UnitSystem {
1830 METRIC = 0,
1831 IMPERIAL = 1,
1832 }
1833
1834 interface TransitOptions {
1835 arrivalTime?: Date;
1836 departureTime?: Date;
1837 modes?: TransitMode[];
1838 routingPreference?: TransitRoutePreference;
1839 }
1840
1841 enum TransitMode {
1842 BUS = 'BUS',
1843 RAIL = 'RAIL',
1844 SUBWAY = 'SUBWAY',
1845 TRAIN = 'TRAIN',
1846 TRAM = 'TRAM',
1847 }
1848
1849 enum TransitRoutePreference {
1850 FEWER_TRANSFERS = 'FEWER_TRANSFERS',
1851 LESS_WALKING = 'LESS_WALKING',
1852 }
1853
1854 interface TransitFare {
1855 currency: string;
1856 value: number;
1857 }
1858
1859 interface DrivingOptions {
1860 departureTime: Date;
1861 trafficModel?: TrafficModel;
1862 }
1863
1864 enum TrafficModel {
1865 BEST_GUESS = 'bestguess',
1866 OPTIMISTIC = 'optimistic',
1867 PESSIMISTIC = 'pessimistic',
1868 }
1869
1870 /**
1871 * A DirectionsWaypoint represents a location between origin and destination
1872 * through which the trip should be routed.
1873 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/directions#DirectionsWaypoint Maps JavaScript API}
1874 */
1875 interface DirectionsWaypoint {
1876 /**
1877 * Waypoint location. Can be an address string, a {@link LatLng}, or a
1878 * {@link Place}.
1879 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/directions#DirectionsWaypoint.location Maps JavaScript API}
1880 */
1881 location?: string | LatLng | Place;
1882 /**
1883 * If `true`, indicates that this waypoint is a stop between the origin and
1884 * destination. This has the effect of splitting the route into two legs. If
1885 * `false`, indicates that the route should be biased to go through this
1886 * waypoint, but not split into two legs. This is useful if you want to
1887 * create a route in response to the user dragging waypoints on a map.
1888 * @default true
1889 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/directions#DirectionsWaypoint.stopover Maps JavaScript API}
1890 */
1891 stopover?: boolean;
1892 }
1893
1894 enum DirectionsStatus {
1895 INVALID_REQUEST = 'INVALID_REQUEST',
1896 MAX_WAYPOINTS_EXCEEDED = 'MAX_WAYPOINTS_EXCEEDED',
1897 NOT_FOUND = 'NOT_FOUND',
1898 OK = 'OK',
1899 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
1900 REQUEST_DENIED = 'REQUEST_DENIED',
1901 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
1902 ZERO_RESULTS = 'ZERO_RESULTS',
1903 }
1904
1905 interface DirectionsResult {
1906 geocoded_waypoints: DirectionsGeocodedWaypoint[];
1907 routes: DirectionsRoute[];
1908 }
1909
1910 /**
1911 * A single geocoded waypoint.
1912 */
1913 interface DirectionsGeocodedWaypoint {
1914 partial_match: boolean;
1915 place_id: string;
1916 types: string[];
1917 }
1918
1919 /**
1920 * A single route containing a set of legs in a DirectionsResult.
1921 * Note that though this object is "JSON-like," it is not strictly JSON,
1922 * as it directly and indirectly includes LatLng objects.
1923 */
1924 interface DirectionsRoute {
1925 /** The bounds for this route. */
1926 bounds: LatLngBounds;
1927 /** Copyrights text to be displayed for this route. */
1928 copyrights: string;
1929 /**
1930 * The total fare for the whole transit trip. Only applicable to transit
1931 * requests.
1932 */
1933 fare: TransitFare;
1934 /**
1935 * An array of DirectionsLegs, each of which contains information about the
1936 * steps of which it is composed. There will be one leg for each stopover
1937 * waypoint or destination specified. So a route with no stopover waypoints
1938 * will contain one DirectionsLeg and a route with one stopover waypoint
1939 * will contain two.
1940 */
1941 legs: DirectionsLeg[];
1942 /**
1943 * An array of LatLngs representing the entire course of this route. The
1944 * path is simplified in order to make it suitable in contexts where a small
1945 * number of vertices is required (such as Static Maps API URLs).
1946 */
1947 overview_path: LatLng[];
1948 /**
1949 * An encoded polyline representation of the route in overview_path.
1950 * This polyline is an approximate (smoothed) path of the resulting
1951 * directions.
1952 */
1953 overview_polyline: string;
1954 /** Warnings to be displayed when showing these directions. */
1955 warnings: string[];
1956 /**
1957 * If optimizeWaypoints was set to true, this field will contain the
1958 * re-ordered permutation of the input waypoints. For example, if the input
1959 * was: Origin: Los Angeles Waypoints: Dallas, Bangor, Phoenix Destination:
1960 * New York and the optimized output was ordered as follows: Origin: Los
1961 * Angeles Waypoints: Phoenix, Dallas, Bangor Destination: New York then
1962 * this field will be an Array containing the values [2, 0, 1]. Note that
1963 * the numbering of waypoints is zero-based. If any of the input waypoints
1964 * has stopover set to false, this field will be empty, since route
1965 * optimization is not available for such queries.
1966 */
1967 waypoint_order: number[];
1968 }
1969
1970 interface DirectionsLeg {
1971 arrival_time: Time;
1972 departure_time: Time;
1973 distance: Distance;
1974 duration: Duration;
1975 duration_in_traffic: Duration;
1976 end_address: string;
1977 end_location: LatLng;
1978 start_address: string;
1979 start_location: LatLng;
1980 steps: DirectionsStep[];
1981 via_waypoints: LatLng[];
1982 }
1983
1984 interface BaseDirectionsStep {
1985 distance: Distance;
1986 duration: Duration;
1987 end_location: LatLng;
1988 instructions: string;
1989 path: LatLng[];
1990 start_location: LatLng;
1991 transit: TransitDetails;
1992 travel_mode: TravelMode;
1993 }
1994
1995 interface DirectionsStep extends BaseDirectionsStep {
1996 /**
1997 * This field will only be available if travel_mode is set to TRANSIT.
1998 */
1999 steps: BaseDirectionsStep[];
2000 }
2001
2002 interface Distance {
2003 text: string;
2004 value: number;
2005 }
2006
2007 interface Duration {
2008 text: string;
2009 value: number;
2010 }
2011
2012 interface Time {
2013 text: string;
2014 time_zone: string;
2015 value: Date;
2016 }
2017
2018 interface TransitDetails {
2019 arrival_stop: TransitStop;
2020 arrival_time: Time;
2021 departure_stop: TransitStop;
2022 departure_time: Time;
2023 headsign: string;
2024 headway: number;
2025 line: TransitLine;
2026 num_stops: number;
2027 }
2028
2029 interface TransitStop {
2030 location: LatLng;
2031 name: string;
2032 }
2033
2034 interface TransitLine {
2035 agencies: TransitAgency[];
2036 color: string;
2037 icon: string;
2038 name: string;
2039 short_name: string;
2040 text_color: string;
2041 url: string;
2042 vehicle: TransitVehicle;
2043 }
2044
2045 interface TransitAgency {
2046 name: string;
2047 phone: string;
2048 url: string;
2049 }
2050
2051 interface TransitVehicle {
2052 icon: string;
2053 local_icon: string;
2054 name: string;
2055 type: VehicleType;
2056 }
2057
2058 enum VehicleType {
2059 BUS,
2060 CABLE_CAR,
2061 COMMUTER_TRAIN,
2062 FERRY,
2063 FUNICULAR,
2064 GONDOLA_LIFT,
2065 HEAVY_RAIL,
2066 HIGH_SPEED_TRAIN,
2067 INTERCITY_BUS,
2068 METRO_RAIL,
2069 MONORAIL,
2070 OTHER,
2071 RAIL,
2072 SHARE_TAXI,
2073 SUBWAY,
2074 TRAM,
2075 TROLLEYBUS,
2076 }
2077
2078 class ElevationService {
2079 getElevationAlongPath(
2080 request: PathElevationRequest,
2081 callback: (results: ElevationResult[], status: ElevationStatus) => void,
2082 ): void;
2083 getElevationForLocations(
2084 request: LocationElevationRequest,
2085 callback: (results: ElevationResult[], status: ElevationStatus) => void,
2086 ): void;
2087 }
2088
2089 interface LocationElevationRequest {
2090 locations: LatLng[];
2091 }
2092
2093 interface PathElevationRequest {
2094 path?: LatLng[];
2095 samples?: number;
2096 }
2097
2098 interface ElevationResult {
2099 elevation: number;
2100 location: LatLng;
2101 resolution: number;
2102 }
2103
2104 enum ElevationStatus {
2105 INVALID_REQUEST = 'INVALID_REQUEST',
2106 OK = 'OK',
2107 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
2108 REQUEST_DENIED = 'REQUEST_DENIED',
2109 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
2110 }
2111
2112 class MaxZoomService {
2113 getMaxZoomAtLatLng(latlng: LatLng | LatLngLiteral, callback: (result: MaxZoomResult) => void): void;
2114 }
2115
2116 interface MaxZoomResult {
2117 status: MaxZoomStatus;
2118 zoom: number;
2119 }
2120
2121 enum MaxZoomStatus {
2122 ERROR = 'ERROR',
2123 OK = 'OK',
2124 }
2125
2126 class DistanceMatrixService {
2127 getDistanceMatrix(
2128 request: DistanceMatrixRequest,
2129 callback: (response: DistanceMatrixResponse, status: DistanceMatrixStatus) => void,
2130 ): void;
2131 }
2132
2133 interface DistanceMatrixRequest {
2134 avoidFerries?: boolean;
2135 avoidHighways?: boolean;
2136 avoidTolls?: boolean;
2137 destinations?: string[] | LatLng[] | LatLngLiteral[] | Place[];
2138 drivingOptions?: DrivingOptions;
2139 durationInTraffic?: boolean;
2140 origins?: string[] | LatLng[] | LatLngLiteral[] | Place[];
2141 region?: string;
2142 transitOptions?: TransitOptions;
2143 travelMode?: TravelMode;
2144 unitSystem?: UnitSystem;
2145 }
2146
2147 interface DistanceMatrixResponse {
2148 destinationAddresses: string[];
2149 originAddresses: string[];
2150 rows: DistanceMatrixResponseRow[];
2151 }
2152
2153 interface DistanceMatrixResponseRow {
2154 elements: DistanceMatrixResponseElement[];
2155 }
2156
2157 interface DistanceMatrixResponseElement {
2158 distance: Distance;
2159 duration: Duration;
2160 duration_in_traffic: Duration;
2161 fare: TransitFare;
2162 status: DistanceMatrixElementStatus;
2163 }
2164
2165 enum DistanceMatrixStatus {
2166 INVALID_REQUEST = 'INVALID_REQUEST',
2167 MAX_DIMENSIONS_EXCEEDED = 'MAX_DIMENSIONS_EXCEEDED',
2168 MAX_ELEMENTS_EXCEEDED = 'MAX_ELEMENTS_EXCEEDED',
2169 OK = 'OK',
2170 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
2171 REQUEST_DENIED = 'REQUEST_DENIED',
2172 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
2173 }
2174
2175 enum DistanceMatrixElementStatus {
2176 NOT_FOUND = 'NOT_FOUND',
2177 OK = 'OK',
2178 ZERO_RESULTS = 'ZERO_RESULTS',
2179 }
2180
2181 /***** Save to Google Maps *****/
2182 interface Attribution {
2183 iosDeepLinkId?: string;
2184 source?: string;
2185 webUrl?: string;
2186 }
2187
2188 interface Place {
2189 location?: LatLng | LatLngLiteral;
2190 placeId?: string;
2191 query?: string;
2192 }
2193
2194 class SaveWidget {
2195 constructor(container: Node, opts?: SaveWidgetOptions);
2196 getAttribution(): Attribution;
2197 getPlace(): Place;
2198 setAttribution(attribution: Attribution): void;
2199 setOptions(opts: SaveWidgetOptions): void;
2200 setPlace(place: Place): void;
2201 }
2202
2203 interface SaveWidgetOptions {
2204 attribution?: Attribution;
2205 place?: Place;
2206 }
2207
2208 /***** Map Types *****/
2209 interface MapType {
2210 getTile(tileCoord: Point, zoom: number, ownerDocument: Document): Element;
2211 releaseTile(tile: Element): void;
2212 alt?: string;
2213 maxZoom?: number;
2214 minZoom?: number;
2215 name?: string;
2216 projection?: Projection;
2217 radius?: number;
2218 tileSize?: Size;
2219 }
2220
2221 class MapTypeRegistry extends MVCObject {
2222 constructor();
2223 set(id: string, mapType: MapType): void;
2224 }
2225
2226 interface Projection {
2227 fromLatLngToPoint(latLng: LatLng, point?: Point): Point;
2228 fromPointToLatLng(pixel: Point, noWrap?: boolean): LatLng;
2229 }
2230
2231 class ImageMapType extends MVCObject implements MapType {
2232 constructor(opts: ImageMapTypeOptions);
2233 getOpacity(): number;
2234 getTile(tileCoord: Point, zoom: number, ownerDocument: Document): Element;
2235 releaseTile(tile: Element): void;
2236 setOpacity(opacity: number): void;
2237 alt: string;
2238 maxZoom: number;
2239 minZoom: number;
2240 name: string;
2241 projection: Projection;
2242 radius: number;
2243 tileSize: Size;
2244 }
2245
2246 interface ImageMapTypeOptions {
2247 alt?: string;
2248 getTileUrl(tileCoord: Point, zoom: number): string;
2249 maxZoom?: number;
2250 minZoom?: number;
2251 name?: string;
2252 opacity?: number;
2253 tileSize: Size;
2254 }
2255
2256 class StyledMapType extends MVCObject implements MapType {
2257 constructor(styles: MapTypeStyle[], options?: StyledMapTypeOptions);
2258 getTile(tileCoord: Point, zoom: number, ownerDocument: Document): Element;
2259 releaseTile(tile: Element): void;
2260 alt: string;
2261 maxZoom: number;
2262 minZoom: number;
2263 name: string;
2264 projection: Projection;
2265 radius: number;
2266 tileSize: Size;
2267 }
2268
2269 interface StyledMapTypeOptions {
2270 alt?: string;
2271 maxZoom?: number;
2272 minZoom?: number;
2273 name?: string;
2274 }
2275
2276 interface MapTypeStyle {
2277 elementType?: MapTypeStyleElementType;
2278 featureType?: MapTypeStyleFeatureType;
2279 stylers?: MapTypeStyler[];
2280 }
2281
2282 type MapTypeStyleFeatureType =
2283 | 'all'
2284 | 'administrative'
2285 | 'administrative.country'
2286 | 'administrative.land_parcel'
2287 | 'administrative.locality'
2288 | 'administrative.neighborhood'
2289 | 'administrative.province'
2290 | 'landscape'
2291 | 'landscape.man_made'
2292 | 'landscape.natural'
2293 | 'landscape.natural.landcover'
2294 | 'landscape.natural.terrain'
2295 | 'poi'
2296 | 'poi.attraction'
2297 | 'poi.business'
2298 | 'poi.government'
2299 | 'poi.medical'
2300 | 'poi.park'
2301 | 'poi.place_of_worship'
2302 | 'poi.school'
2303 | 'poi.sports_complex'
2304 | 'road'
2305 | 'road.arterial'
2306 | 'road.highway'
2307 | 'road.highway.controlled_access'
2308 | 'road.local'
2309 | 'transit'
2310 | 'transit.line'
2311 | 'transit.station'
2312 | 'transit.station.airport'
2313 | 'transit.station.bus'
2314 | 'transit.station.rail'
2315 | 'water';
2316
2317 type MapTypeStyleElementType =
2318 | 'all'
2319 | 'geometry'
2320 | 'geometry.fill'
2321 | 'geometry.stroke'
2322 | 'labels'
2323 | 'labels.icon'
2324 | 'labels.text'
2325 | 'labels.text.fill'
2326 | 'labels.text.stroke';
2327
2328 interface MapTypeStyler {
2329 color?: string;
2330 gamma?: number;
2331 hue?: string;
2332 invert_lightness?: boolean;
2333 lightness?: number;
2334 saturation?: number;
2335 visibility?: string;
2336 weight?: number;
2337 }
2338
2339 /***** Layers *****/
2340 class BicyclingLayer extends MVCObject {
2341 constructor();
2342 getMap(): Map;
2343 setMap(map: Map | null): void;
2344 }
2345
2346 class FusionTablesLayer extends MVCObject {
2347 constructor(options: FusionTablesLayerOptions);
2348 getMap(): Map;
2349 setMap(map: Map | null): void;
2350 setOptions(options: FusionTablesLayerOptions): void;
2351 }
2352
2353 interface FusionTablesLayerOptions {
2354 clickable?: boolean;
2355 heatmap?: FusionTablesHeatmap;
2356 map?: Map;
2357 query?: FusionTablesQuery;
2358 styles?: FusionTablesStyle[];
2359 suppressInfoWindows?: boolean;
2360 }
2361
2362 interface FusionTablesQuery {
2363 from?: string;
2364 limit?: number;
2365 offset?: number;
2366 orderBy?: string;
2367 select?: string;
2368 where?: string;
2369 }
2370
2371 interface FusionTablesStyle {
2372 markerOptions?: FusionTablesMarkerOptions;
2373 polygonOptions?: FusionTablesPolygonOptions;
2374 polylineOptions?: FusionTablesPolylineOptions;
2375 where?: string;
2376 }
2377
2378 interface FusionTablesHeatmap {
2379 enabled: boolean;
2380 }
2381
2382 interface FusionTablesMarkerOptions {
2383 iconName: string;
2384 }
2385
2386 interface FusionTablesPolygonOptions {
2387 fillColor?: string;
2388 fillOpacity?: number;
2389 strokeColor?: string;
2390 strokeOpacity?: number;
2391 strokeWeight?: number;
2392 }
2393
2394 interface FusionTablesPolylineOptions {
2395 strokeColor?: string;
2396 strokeOpacity?: number;
2397 strokeWeight?: number;
2398 }
2399
2400 interface FusionTablesMouseEvent {
2401 infoWindowHtml?: string;
2402 latLng?: LatLng;
2403 pixelOffset?: Size;
2404 row?: object; // Object<FusionTablesCell>
2405 }
2406
2407 interface FusionTablesCell {
2408 columnName?: string;
2409 value?: string;
2410 }
2411
2412 class KmlLayer extends MVCObject {
2413 constructor(opts?: KmlLayerOptions);
2414 getDefaultViewport(): LatLngBounds;
2415 getMap(): Map;
2416 getMetadata(): KmlLayerMetadata;
2417 getStatus(): KmlLayerStatus;
2418 getUrl(): string;
2419 getZIndex(): number;
2420 setMap(map: Map | null): void;
2421 setUrl(url: string): void;
2422 setZIndex(zIndex: number): void;
2423 setOptions(options: KmlLayerOptions): void;
2424 }
2425
2426 interface KmlLayerOptions {
2427 clickable?: boolean;
2428 map?: Map;
2429 preserveViewport?: boolean;
2430 screenOverlays?: boolean;
2431 suppressInfoWindows?: boolean;
2432 url?: string;
2433 zIndex?: number;
2434 }
2435
2436 interface KmlLayerMetadata {
2437 author: KmlAuthor;
2438 description: string;
2439 hasScreenOverlays: boolean;
2440 name: string;
2441 snippet: string;
2442 }
2443
2444 enum KmlLayerStatus {
2445 DOCUMENT_NOT_FOUND = 'DOCUMENT_NOT_FOUND',
2446 DOCUMENT_TOO_LARGE = 'DOCUMENT_TOO_LARGE',
2447 FETCH_ERROR = 'FETCH_ERROR',
2448 INVALID_DOCUMENT = 'INVALID_DOCUMENT',
2449 INVALID_REQUEST = 'INVALID_REQUEST',
2450 LIMITS_EXCEEDED = 'LIMITS_EXCEEDED',
2451 OK = 'OK',
2452 TIMED_OUT = 'TIMED_OUT',
2453 UNKNOWN = 'UNKNOWN',
2454 }
2455
2456 interface KmlMouseEvent {
2457 featureData: KmlFeatureData;
2458 latLng: LatLng;
2459 pixelOffset: Size;
2460 }
2461
2462 interface KmlFeatureData {
2463 author: KmlAuthor;
2464 description: string;
2465 id: string;
2466 infoWindowHtml: string;
2467 name: string;
2468 snippet: string;
2469 }
2470
2471 interface KmlAuthor {
2472 email: string;
2473 name: string;
2474 uri: string;
2475 }
2476
2477 class TrafficLayer extends MVCObject {
2478 constructor(opts?: TrafficLayerOptions);
2479 getMap(): Map;
2480 setMap(map: Map | null): void;
2481 setOptions(options: TrafficLayerOptions): void;
2482 }
2483
2484 interface TrafficLayerOptions {
2485 autoRefresh?: boolean;
2486 map?: Map;
2487 }
2488
2489 class TransitLayer extends MVCObject {
2490 constructor();
2491 getMap(): void;
2492 setMap(map: Map | null): void;
2493 }
2494
2495 /***** Street View *****/
2496 class StreetViewPanorama extends MVCObject {
2497 constructor(container: Element, opts?: StreetViewPanoramaOptions);
2498 controls: Array<MVCArray<Node>>;
2499 getLinks(): StreetViewLink[];
2500 getLocation(): StreetViewLocation;
2501 getMotionTracking(): boolean;
2502 getPano(): string;
2503 getPhotographerPov(): StreetViewPov;
2504 getPosition(): LatLng;
2505 getPov(): StreetViewPov;
2506 getStatus(): StreetViewStatus;
2507 getVisible(): boolean;
2508 getZoom(): number;
2509 registerPanoProvider(provider: (input: string) => StreetViewPanoramaData, opts?: PanoProviderOptions): void;
2510 setLinks(links: StreetViewLink[]): void;
2511 setMotionTracking(motionTracking: boolean): void;
2512 setOptions(options: StreetViewPanoramaOptions): void;
2513 setPano(pano: string): void;
2514 setPosition(latLng: LatLng | LatLngLiteral): void;
2515 setPov(pov: StreetViewPov): void;
2516 setVisible(flag: boolean): void;
2517 setZoom(zoom: number): void;
2518 }
2519
2520 /** Options for the rendering of the fullscreen control. */
2521 interface FullscreenControlOptions {
2522 /**
2523 * Position id. Used to specify the position of the control on the map.
2524 * The default position is RIGHT_TOP.
2525 */
2526 position?: ControlPosition;
2527 }
2528
2529 interface StreetViewPanoramaOptions {
2530 addressControl?: boolean;
2531 addressControlOptions?: StreetViewAddressControlOptions;
2532 clickToGo?: boolean;
2533 disableDefaultUI?: boolean;
2534 disableDoubleClickZoom?: boolean;
2535 enableCloseButton?: boolean;
2536 fullscreenControl?: boolean;
2537 fullscreenControlOptions?: FullscreenControlOptions;
2538 imageDateControl?: boolean;
2539 linksControl?: boolean;
2540 motionTracking?: boolean;
2541 motionTrackingControl?: boolean;
2542 motionTrackingControlOptions?: MotionTrackingControlOptions;
2543 mode?: 'html4' | 'html5' | 'webgl';
2544 panControl?: boolean;
2545 panControlOptions?: PanControlOptions;
2546 pano?: string;
2547 panoProvider?: (input: string) => StreetViewPanoramaData;
2548 position?: LatLng | LatLngLiteral;
2549 pov?: StreetViewPov;
2550 scrollwheel?: boolean;
2551 visible?: boolean;
2552 zoom?: number;
2553 zoomControl?: boolean;
2554 zoomControlOptions?: ZoomControlOptions;
2555 }
2556
2557 interface StreetViewAddressControlOptions {
2558 position?: ControlPosition;
2559 }
2560
2561 interface StreetViewLink {
2562 description?: string;
2563 heading?: number;
2564 pano?: string;
2565 }
2566
2567 interface StreetViewPov {
2568 heading?: number;
2569 pitch?: number;
2570 }
2571
2572 interface StreetViewPanoramaData {
2573 copyright?: string;
2574 imageDate?: string;
2575 links?: StreetViewLink[];
2576 location?: StreetViewLocation;
2577 tiles?: StreetViewTileData;
2578 }
2579
2580 interface StreetViewLocation {
2581 description?: string;
2582 latLng?: LatLng;
2583 pano?: string;
2584 shortDescription?: string;
2585 }
2586
2587 interface StreetViewTileData {
2588 getTileUrl(pano: string, tileZoom: number, tileX: number, tileY: number): string;
2589 centerHeading?: number;
2590 tileSize?: Size;
2591 worldSize?: Size;
2592 }
2593
2594 enum StreetViewPreference {
2595 BEST = 'best',
2596 NEAREST = 'nearest',
2597 }
2598
2599 enum StreetViewSource {
2600 DEFAULT = 'default',
2601 OUTDOOR = 'outdoor',
2602 }
2603
2604 interface StreetViewLocationRequest {
2605 location: LatLng | LatLngLiteral;
2606 preference?: StreetViewPreference;
2607 radius?: number;
2608 source?: StreetViewSource;
2609 }
2610
2611 interface StreetViewPanoRequest {
2612 pano: string;
2613 }
2614
2615 class StreetViewService {
2616 getPanorama(
2617 request: StreetViewLocationRequest | StreetViewPanoRequest,
2618 cb: (data: StreetViewPanoramaData | null, status: StreetViewStatus) => void,
2619 ): void;
2620 getPanoramaById(
2621 pano: string,
2622 callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void,
2623 ): void;
2624 getPanoramaByLocation(
2625 latlng: LatLng | LatLngLiteral,
2626 radius: number,
2627 callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void,
2628 ): void;
2629 }
2630
2631 enum StreetViewStatus {
2632 OK = 'OK',
2633 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
2634 ZERO_RESULTS = 'ZERO_RESULTS',
2635 }
2636
2637 class StreetViewCoverageLayer extends MVCObject {
2638 getMap(): Map;
2639 setMap(map: Map | null): void;
2640 }
2641
2642 interface MotionTrackingControlOptions {
2643 position?: ControlPosition;
2644 }
2645
2646 interface PanoProviderOptions {
2647 /**
2648 * If set, the renderer will use technologies (like webgl) that only work when cors headers are appropiately set on the provided images.
2649 * It is the developer's task to serve the images correctly in combination with this flag, which might otherwise lead to SecurityErrors.
2650 */
2651 cors?: boolean;
2652 }
2653
2654 /***** Events *****/
2655 interface MapsEventListener {
2656 /**
2657 * Removes the listener. Equivalent to calling
2658 * google.maps.event.removeListener(listener).
2659 */
2660 remove(): void;
2661 }
2662
2663 namespace event {
2664 /**
2665 * Cross browser event handler registration. This listener is removed by
2666 * calling removeListener(handle) for the handle that is returned by this
2667 * function.
2668 */
2669 function addDomListener(
2670 instance: object,
2671 eventName: string,
2672 handler: (event: Event) => void,
2673 capture?: boolean,
2674 ): MapsEventListener;
2675 /**
2676 * Wrapper around addDomListener that removes the listener after the first
2677 * event.
2678 */
2679 function addDomListenerOnce(
2680 instance: object,
2681 eventName: string,
2682 handler: (event: Event) => void,
2683 capture?: boolean,
2684 ): MapsEventListener;
2685 /**
2686 * Adds the given listener function to the given event name for the given
2687 * object instance. Returns an identifier for this listener that can be used
2688 * with removeListener().
2689 */
2690 function addListener(instance: object, eventName: string, handler: (...args: any[]) => void): MapsEventListener;
2691 /**
2692 * Like addListener, but the handler removes itself after handling the first
2693 * event.
2694 */
2695 function addListenerOnce(
2696 instance: object,
2697 eventName: string,
2698 handler: (...args: any[]) => void,
2699 ): MapsEventListener;
2700 /**
2701 * Removes all listeners for all events for the given instance.
2702 */
2703 function clearInstanceListeners(instance: object): void;
2704 /**
2705 * Removes all listeners for the given event for the given instance.
2706 */
2707 function clearListeners(instance: object, eventName: string): void;
2708 /**
2709 * Removes the given listener, which should have been returned by
2710 * addListener above. Equivalent to calling listener.remove().
2711 */
2712 function removeListener(listener: MapsEventListener): void;
2713 /**
2714 * Triggers the given event. All arguments after eventName are passed as
2715 * arguments to the listeners.
2716 */
2717 function trigger(instance: any, eventName: string, ...args: any[]): void;
2718 }
2719
2720 /**
2721 * This object is returned from various mouse events on the map and overlays,
2722 * and contains all the fields shown below.
2723 */
2724 interface MouseEvent {
2725 /** Prevents this event from propagating further. */
2726 stop(): void;
2727 /**
2728 * The latitude/longitude that was below the cursor when the event
2729 * occurred.
2730 */
2731 latLng: LatLng;
2732 }
2733
2734 /**
2735 * This object is sent in an event when a user clicks on an icon on the map.
2736 * The place ID of this place is stored in the placeId member.
2737 * To prevent the default info window from showing up, call the stop() method
2738 * on this event to prevent it being propagated. Learn more about place IDs in
2739 * the Places API developer guide.
2740 */
2741 interface IconMouseEvent extends MouseEvent {
2742 /**
2743 * The place ID of the place that was clicked.
2744 * This place ID can be used to query more information about the feature
2745 * that was clicked.
2746 */
2747 placeId: string;
2748 }
2749
2750 /* **** Base **** */
2751
2752 /**
2753 * A LatLng is a point in geographical coordinates: latitude and longitude.
2754 *
2755 * * Latitude ranges between -90 and 90 degrees, inclusive. Values above or
2756 * below this range will be clamped to the range [-90, 90]. This means
2757 * that if the value specified is less than -90, it will be set to -90.
2758 * And if the value is greater than 90, it will be set to 90.
2759 * * Longitude ranges between -180 and 180 degrees, inclusive. Values above
2760 * or below this range will be wrapped so that they fall within the
2761 * range. For example, a value of -190 will be converted to 170. A value
2762 * of 190 will be converted to -170. This reflects the fact that
2763 * longitudes wrap around the globe.
2764 *
2765 * Although the default map projection associates longitude with the
2766 * x-coordinate of the map, and latitude with the y-coordinate, the
2767 * latitude coordinate is always written first, followed by the longitude.
2768 * Notice that you cannot modify the coordinates of a LatLng. If you want
2769 * to compute another point, you have to create a new one.
2770 */
2771 class LatLng {
2772 /**
2773 * Creates a LatLng object representing a geographic point.
2774 * Note the ordering of latitude and longitude.
2775 * @param lat Latitude is specified in degrees within the range [-90, 90].
2776 * @param lng Longitude is specified in degrees within the range [-180,
2777 * 180].
2778 * @param noWrap Set noWrap to true to enable values outside of this range.
2779 */
2780 constructor(lat: number, lng: number, noWrap?: boolean);
2781 /**
2782 * Creates a LatLng object representing a geographic point.
2783 * @param literal Object literal.
2784 * @param noWrap Set noWrap to true to enable values outside of this range.
2785 */
2786 constructor(literal: LatLngLiteral, noWrap?: boolean);
2787 /** Comparison function. */
2788 equals(other: LatLng): boolean;
2789 /** Returns the latitude in degrees. */
2790 lat(): number;
2791 /** Returns the longitude in degrees. */
2792 lng(): number;
2793 /** Converts to string representation. */
2794 toString(): string;
2795 /**
2796 * Returns a string of the form "lat,lng". We round the lat/lng values to 6
2797 * decimal places by default.
2798 */
2799 toUrlValue(precision?: number): string;
2800 /**
2801 * Converts to JSON representation. This function is intended to be used
2802 * via JSON.stringify.
2803 */
2804 toJSON(): LatLngLiteral;
2805 }
2806
2807 /**
2808 * Object literals are accepted in place of {@link LatLng} objects, as a
2809 * convenience, in many places. These are converted to {@link LatLng} objects
2810 * when the Maps API encounters them.
2811 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngLiteral Maps JavaScript API}
2812 */
2813 interface LatLngLiteral {
2814 /**
2815 * Latitude in degrees. Values will be clamped to the range [-90, 90]. This
2816 * means that if the value specified is less than -90, it will be set to
2817 * -90. And if the value is greater than 90, it will be set to 90.
2818 */
2819 lat: number;
2820 /**
2821 * Longitude in degrees. Values outside the range [-180, 180] will be
2822 * wrapped so that they fall within the range. For example, a value of -190
2823 * will be converted to 170. A value of 190 will be converted to -170. This
2824 * reflects the fact that longitudes wrap around the globe.
2825 */
2826 lng: number;
2827 }
2828
2829 /** @see {@link LatLngLiteral}. */
2830 interface ReadonlyLatLngLiteral {
2831 /** @see {@link LatLngLiteral#lat} */
2832 readonly lat: number;
2833 /** @see {@link LatLngLiteral#lng} */
2834 readonly lng: number;
2835 }
2836
2837 interface LatLngBoundsLiteral {
2838 east: number;
2839 north: number;
2840 south: number;
2841 west: number;
2842 }
2843
2844 /**
2845 * A LatLngBounds instance represents a rectangle in geographical coordinates,
2846 * including one that crosses the 180 degrees longitudinal meridian.
2847 */
2848 class LatLngBounds {
2849 /**
2850 * Constructs a rectangle from the points at its south-west and north-east
2851 * corners.
2852 */
2853 constructor(sw?: LatLng | LatLngLiteral, ne?: LatLng | LatLngLiteral);
2854 /** Returns true if the given lat/lng is in this bounds. */
2855 contains(latLng: LatLng | LatLngLiteral): boolean;
2856 /** Returns true if this bounds approximately equals the given bounds. */
2857 equals(other: LatLngBounds | LatLngBoundsLiteral): boolean;
2858 /** Extends this bounds to contain the given point. */
2859 extend(point: LatLng | LatLngLiteral): LatLngBounds;
2860 /** Computes the center of this LatLngBounds */
2861 getCenter(): LatLng;
2862 /** Returns the north-east corner of this bounds. */
2863 getNorthEast(): LatLng;
2864 /** Returns the south-west corner of this bounds. */
2865 getSouthWest(): LatLng;
2866 /** Returns true if this bounds shares any points with the other bounds. */
2867 intersects(other: LatLngBounds | LatLngBoundsLiteral): boolean;
2868 /** Returns if the bounds are empty. */
2869 isEmpty(): boolean;
2870 /**
2871 * Converts to JSON representation. This function is intended to be used
2872 * via JSON.stringify.
2873 */
2874 toJSON(): LatLngBoundsLiteral;
2875 /** Converts the given map bounds to a lat/lng span. */
2876 toSpan(): LatLng;
2877 /** Converts to string. */
2878 toString(): string;
2879 /**
2880 * Returns a string of the form "lat_lo,lng_lo,lat_hi,lng_hi" for this
2881 * bounds, where "lo" corresponds to the southwest corner of the bounding
2882 * box, while "hi" corresponds to the northeast corner of that box.
2883 */
2884 toUrlValue(precision?: number): string;
2885 /**
2886 * Extends this bounds to contain the union of this and the given bounds.
2887 */
2888 union(other: LatLngBounds | LatLngBoundsLiteral): LatLngBounds;
2889 }
2890
2891 class Point {
2892 /** A point on a two-dimensional plane. */
2893 constructor(x: number, y: number);
2894 /** The X coordinate */
2895 x: number;
2896 /** The Y coordinate */
2897 y: number;
2898 /** Compares two Points */
2899 equals(other: Point): boolean;
2900 /** Returns a string representation of this Point. */
2901 toString(): string;
2902 }
2903
2904 class Size {
2905 constructor(width: number, height: number, widthUnit?: string, heightUnit?: string);
2906 height: number;
2907 width: number;
2908 equals(other: Size): boolean;
2909 toString(): string;
2910 }
2911
2912 /***** MVC *****/
2913 /** Base class implementing KVO. */
2914 class MVCObject {
2915 /**
2916 * The MVCObject constructor is guaranteed to be an empty function, and so
2917 * you may inherit from MVCObject by simply writing MySubclass.prototype =
2918 * new google.maps.MVCObject();. Unless otherwise noted, this is not true of
2919 * other classes in the API, and inheriting from other classes in the API is
2920 * not supported.
2921 */
2922 constructor();
2923 /**
2924 * Adds the given listener function to the given event name. Returns an
2925 * identifier for this listener that can be used with
2926 * google.maps.event.removeListener.
2927 */
2928 addListener(eventName: string, handler: (...args: any[]) => void): MapsEventListener;
2929 /** Binds a View to a Model. */
2930 bindTo(key: string, target: MVCObject, targetKey?: string, noNotify?: boolean): void;
2931 changed(key: string): void;
2932 /** Gets a value. */
2933 get(key: string): any;
2934 /**
2935 * Notify all observers of a change on this property. This notifies both
2936 * objects that are bound to the object's property as well as the object
2937 * that it is bound to.
2938 */
2939 notify(key: string): void;
2940 /** Sets a value. */
2941 set(key: string, value: any): void;
2942 /** Sets a collection of key-value pairs. */
2943 setValues(values: any): void;
2944 /**
2945 * Removes a binding. Unbinding will set the unbound property to the current
2946 * value. The object will not be notified, as the value has not changed.
2947 */
2948 unbind(key: string): void;
2949 /** Removes all bindings. */
2950 unbindAll(): void;
2951 }
2952
2953 /** This class extends MVCObject. */
2954 class MVCArray<T> extends MVCObject {
2955 /** A mutable MVC Array. */
2956 constructor(array?: T[]);
2957 /** Removes all elements from the array. */
2958 clear(): void;
2959 /**
2960 * Iterate over each element, calling the provided callback.
2961 * The callback is called for each element like: callback(element, index).
2962 */
2963 forEach(callback: (elem: T, i: number) => void): void;
2964 /**
2965 * Returns a reference to the underlying Array.
2966 * Warning: if the Array is mutated, no events will be fired by this object.
2967 */
2968 getArray(): T[];
2969 /** Returns the element at the specified index. */
2970 getAt(i: number): T;
2971 /** Returns the number of elements in this array. */
2972 getLength(): number;
2973 /** Inserts an element at the specified index. */
2974 insertAt(i: number, elem: T): void;
2975 /** Removes the last element of the array and returns that element. */
2976 pop(): T;
2977 /**
2978 * Adds one element to the end of the array and returns the new length of
2979 * the array.
2980 */
2981 push(elem: T): number;
2982 /** Removes an element from the specified index. */
2983 removeAt(i: number): T;
2984 /** Sets an element at the specified index. */
2985 setAt(i: number, elem: T): void;
2986 }
2987
2988 /***** Geometry Library *****/
2989 namespace geometry {
2990 namespace encoding {
2991 function decodePath(encodedPath: string): LatLng[];
2992 function encodePath(path: LatLng[] | MVCArray<LatLng>): string;
2993 }
2994
2995 /**
2996 * Utility functions for computing geodesic angles, distances and areas.
2997 * The default radius is Earth's radius of 6378137 meters.
2998 */
2999 namespace spherical {
3000 /**
3001 * Returns the area of a closed path.
3002 * The computed area uses the same units as the radius.
3003 * The radius defaults to the Earth's radius in meters,
3004 * in which case the area is in square meters.
3005 */
3006 function computeArea(path: LatLng[] | MVCArray<LatLng>, radius?: number): number;
3007 /**
3008 * Returns the distance, in meters, between two LatLngs.
3009 * You can optionally specify a custom radius.
3010 * The radius defaults to the radius of the Earth.
3011 */
3012 function computeDistanceBetween(from: LatLng, to: LatLng, radius?: number): number;
3013 /**
3014 * Returns the heading from one LatLng to another LatLng.
3015 * Headings are expressed in degrees clockwise from North within the range
3016 * [-180,180).
3017 */
3018 function computeHeading(from: LatLng, to: LatLng): number;
3019 /**
3020 * Returns the length of the given path.
3021 */
3022 function computeLength(path: LatLng[] | MVCArray<LatLng>, radius?: number): number;
3023 /**
3024 * Returns the LatLng resulting from moving a distance from an origin in
3025 * the specified heading (expressed in degrees clockwise from north).
3026 */
3027 function computeOffset(from: LatLng, distance: number, heading: number, radius?: number): LatLng;
3028 /**
3029 * Returns the location of origin when provided with a LatLng destination,
3030 * meters travelled and original heading. Headings are expressed in
3031 * degrees clockwise from North. This function returns null when no
3032 * solution is available.
3033 */
3034 function computeOffsetOrigin(to: LatLng, distance: number, heading: number, radius?: number): LatLng;
3035 /**
3036 * Returns the signed area of a closed path. The signed area may be used
3037 * to determine the orientation of the path. The computed area uses the
3038 * same units as the radius. The radius defaults to the Earth's radius in
3039 * meters, in which case the area is in square meters.
3040 */
3041 function computeSignedArea(loop: LatLng[] | MVCArray<LatLng>, radius?: number): number;
3042 /**
3043 * Returns the LatLng which lies the given fraction of the way between the
3044 * origin LatLng and the destination LatLng.
3045 */
3046 function interpolate(from: LatLng, to: LatLng, fraction: number): LatLng;
3047 }
3048
3049 namespace poly {
3050 function containsLocation(point: LatLng, polygon: Polygon): boolean;
3051 function isLocationOnEdge(point: LatLng, poly: Polygon | Polyline, tolerance?: number): boolean;
3052 }
3053 }
3054
3055 /***** AdSense Library *****/
3056 namespace adsense {
3057 class AdUnit extends MVCObject {
3058 constructor(container: Element, opts: AdUnitOptions);
3059 getBackgroundColor(): string;
3060 getBorderColor(): string;
3061 getChannelNumber(): string;
3062 getContainer(): Element;
3063 getFormat(): AdFormat;
3064 getMap(): Map;
3065 getPosition(): ControlPosition;
3066 getPublisherId(): string;
3067 getTextColor(): string;
3068 getTitleColor(): string;
3069 getUrlColor(): string;
3070 setBackgroundColor(backgroundColor: string): void;
3071 setBorderColor(borderColor: string): void;
3072 setChannelNumber(channelNumber: string): void;
3073 setFormat(format: AdFormat): void;
3074 setMap(map: Map | null): void;
3075 setPosition(position: ControlPosition): void;
3076 setTextColor(textColor: string): void;
3077 setTitleColor(titleColor: string): void;
3078 setUrlColor(urlColor: string): void;
3079 }
3080
3081 interface AdUnitOptions {
3082 backgroundColor?: string;
3083 borderColor?: string;
3084 channelNumber?: string;
3085 format?: AdFormat;
3086 map?: Map;
3087 position?: ControlPosition;
3088 publisherId?: string;
3089 textColor?: string;
3090 titleColor?: string;
3091 urlColor?: string;
3092 }
3093
3094 enum AdFormat {
3095 BANNER = '468x60_as',
3096 BUTTON = '125x125_as',
3097 HALF_BANNER = '234x60_as',
3098 LARGE_HORIZONTAL_LINK_UNIT = '728x15_0ads_al',
3099 LARGE_RECTANGLE = '336x280_as',
3100 LARGE_VERTICAL_LINK_UNIT = '180x90_0ads_al',
3101 LEADERBOARD = '728x90_as',
3102 MEDIUM_RECTANGLE = '300x250_as',
3103 MEDIUM_VERTICAL_LINK_UNIT = '160x90_0ads_al',
3104 SKYSCRAPER = '120x600_as',
3105 SMALL_HORIZONTAL_LINK_UNIT = '468x15_0ads_al',
3106 SMALL_RECTANGLE = '180x150_as',
3107 SMALL_SQUARE = '200x200_as',
3108 SMALL_VERTICAL_LINK_UNIT = '120x90_0ads_al',
3109 SQUARE = '250x250_as',
3110 VERTICAL_BANNER = '120x240_as',
3111 WIDE_SKYSCRAPER = '160x600_as',
3112 X_LARGE_VERTICAL_LINK_UNIT = '200x90_0ads_al',
3113 }
3114 }
3115
3116 /***** Places Library *****/
3117 namespace places {
3118 class Autocomplete extends MVCObject {
3119 constructor(inputField: HTMLInputElement, opts?: AutocompleteOptions);
3120 getBounds(): LatLngBounds;
3121 getPlace(): PlaceResult;
3122 setBounds(bounds: LatLngBounds | LatLngBoundsLiteral): void;
3123 setComponentRestrictions(restrictions: ComponentRestrictions): void;
3124 setFields(fields: string[] | undefined): void;
3125 setOptions(options: AutocompleteOptions): void;
3126 setTypes(types: string[]): void;
3127 }
3128
3129 interface AutocompleteOptions {
3130 bounds?: LatLngBounds | LatLngBoundsLiteral;
3131 componentRestrictions?: ComponentRestrictions;
3132 placeIdOnly?: boolean;
3133 strictBounds?: boolean;
3134 types?: string[];
3135 type?: string;
3136 fields?: string[];
3137 }
3138
3139 interface AutocompletePrediction {
3140 description: string;
3141 matched_substrings: PredictionSubstring[];
3142 place_id: string;
3143 reference: string;
3144 structured_formatting: AutocompleteStructuredFormatting;
3145 terms: PredictionTerm[];
3146 types: string[];
3147 }
3148
3149 interface AutocompleteStructuredFormatting {
3150 main_text: string;
3151 main_text_matched_substrings: PredictionSubstring[];
3152 secondary_text: string;
3153 }
3154
3155 interface OpeningHours {
3156 open_now: boolean;
3157 periods: OpeningPeriod[];
3158 weekday_text: string[];
3159 }
3160
3161 interface OpeningPeriod {
3162 open: OpeningHoursTime;
3163 close?: OpeningHoursTime;
3164 }
3165
3166 interface OpeningHoursTime {
3167 day: number;
3168 hours: number;
3169 minutes: number;
3170 nextDate: number;
3171 time: string;
3172 }
3173
3174 interface PredictionTerm {
3175 offset: number;
3176 value: string;
3177 }
3178
3179 interface PredictionSubstring {
3180 length: number;
3181 offset: number;
3182 }
3183
3184 class AutocompleteService {
3185 constructor();
3186 getPlacePredictions(
3187 request: AutocompletionRequest,
3188 callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void,
3189 ): void;
3190 getQueryPredictions(
3191 request: QueryAutocompletionRequest,
3192 callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void,
3193 ): void;
3194 }
3195
3196 class AutocompleteSessionToken {}
3197
3198 interface AutocompletionRequest {
3199 bounds?: LatLngBounds | LatLngBoundsLiteral;
3200 componentRestrictions?: ComponentRestrictions;
3201 input: string;
3202 location?: LatLng;
3203 offset?: number;
3204 radius?: number;
3205 sessionToken?: AutocompleteSessionToken;
3206 types?: string[];
3207 }
3208
3209 interface ComponentRestrictions {
3210 country: string | string[];
3211 }
3212
3213 type LocationBias =
3214 | LatLng
3215 | LatLngLiteral
3216 | LatLngBounds
3217 | LatLngBoundsLiteral
3218 | Circle
3219 | CircleLiteral
3220 | string;
3221
3222 interface PlaceAspectRating {
3223 rating: number;
3224 type: string;
3225 }
3226
3227 interface PlaceDetailsRequest {
3228 placeId: string;
3229 fields?: string[];
3230 sessionToken?: AutocompleteSessionToken;
3231 }
3232
3233 interface PlaceGeometry {
3234 location: LatLng;
3235 viewport: LatLngBounds;
3236 }
3237
3238 interface PlacePhoto {
3239 height: number;
3240 html_attributions: string[];
3241 width: number;
3242 getUrl(opts: PhotoOptions): string;
3243 }
3244
3245 interface PhotoOptions {
3246 maxHeight?: number;
3247 maxWidth?: number;
3248 }
3249
3250 interface PlaceResult {
3251 address_components?: GeocoderAddressComponent[];
3252 adr_address?: string;
3253 aspects?: PlaceAspectRating[];
3254 formatted_address?: string;
3255 formatted_phone_number?: string;
3256 geometry?: PlaceGeometry;
3257 html_attributions?: string[];
3258 icon?: string;
3259 id?: string;
3260 international_phone_number?: string;
3261 name: string;
3262 opening_hours?: OpeningHours;
3263 permanently_closed?: boolean;
3264 photos?: PlacePhoto[];
3265 place_id?: string;
3266 price_level?: number;
3267 rating?: number;
3268 reviews?: PlaceReview[];
3269 types?: string[];
3270 url?: string;
3271 utc_offset?: number;
3272 vicinity?: string;
3273 website?: string;
3274 }
3275
3276 interface PlaceReview {
3277 aspects: PlaceAspectRating[];
3278 author_name: string;
3279 author_url: string;
3280 language: string;
3281 text: string;
3282 }
3283
3284 interface PlaceSearchPagination {
3285 nextPage(): void;
3286 hasNextPage: boolean;
3287 }
3288
3289 interface PlaceSearchRequest {
3290 bounds?: LatLngBounds | LatLngBoundsLiteral;
3291 keyword?: string;
3292 location?: LatLng | LatLngLiteral;
3293 maxPriceLevel?: number;
3294 minPriceLevel?: number;
3295 name?: string;
3296 openNow?: boolean;
3297 radius?: number;
3298 rankBy?: RankBy;
3299 types?: string[] /* Deprecated. Will be removed February 16, 2017 */;
3300 type?: string;
3301 }
3302
3303 class PlacesService {
3304 constructor(attrContainer: HTMLDivElement | Map);
3305 findPlaceFromPhoneNumber(
3306 request: FindPlaceFromPhoneNumberRequest,
3307 callback: (results: PlaceResult[], status: PlacesServiceStatus) => void,
3308 ): void;
3309 findPlaceFromQuery(
3310 request: FindPlaceFromQueryRequest,
3311 callback: (results: PlaceResult[], status: PlacesServiceStatus) => void,
3312 ): void;
3313 getDetails(
3314 request: PlaceDetailsRequest,
3315 callback: (result: PlaceResult, status: PlacesServiceStatus) => void,
3316 ): void;
3317 nearbySearch(
3318 request: PlaceSearchRequest,
3319 callback: (
3320 results: PlaceResult[],
3321 status: PlacesServiceStatus,
3322 pagination: PlaceSearchPagination,
3323 ) => void,
3324 ): void;
3325 /**
3326 * @deprecated Radar search is deprecated as of June 30, 2018. After that
3327 * time, this feature will no longer be available.
3328 */
3329 radarSearch(
3330 request: RadarSearchRequest,
3331 callback: (results: PlaceResult[], status: PlacesServiceStatus) => void,
3332 ): void;
3333 textSearch(
3334 request: TextSearchRequest,
3335 callback: (
3336 results: PlaceResult[],
3337 status: PlacesServiceStatus,
3338 pagination: PlaceSearchPagination,
3339 ) => void,
3340 ): void;
3341 }
3342
3343 enum PlacesServiceStatus {
3344 INVALID_REQUEST = 'INVALID_REQUEST',
3345 NOT_FOUND = 'NOT_FOUND',
3346 OK = 'OK',
3347 OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
3348 REQUEST_DENIED = 'REQUEST_DENIED',
3349 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
3350 ZERO_RESULTS = 'ZERO_RESULTS',
3351 }
3352
3353 interface QueryAutocompletePrediction {
3354 description: string;
3355 matched_substrings: PredictionSubstring[];
3356 place_id: string;
3357 terms: PredictionTerm[];
3358 }
3359
3360 interface QueryAutocompletionRequest {
3361 bounds?: LatLngBounds | LatLngBoundsLiteral;
3362 input?: string;
3363 location?: LatLng;
3364 offset?: number;
3365 radius?: number;
3366 }
3367
3368 interface RadarSearchRequest {
3369 bounds?: LatLngBounds | LatLngBoundsLiteral;
3370 keyword?: string;
3371 location?: LatLng | LatLngLiteral;
3372 name?: string;
3373 radius?: number;
3374 types?: string[] /* Deprecated. Will be removed February 16, 2017 */;
3375 type?: string;
3376 }
3377
3378 enum RankBy {
3379 PROMINENCE = 0,
3380 DISTANCE = 1,
3381 }
3382
3383 class SearchBox extends MVCObject {
3384 constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions);
3385 getBounds(): LatLngBounds;
3386 getPlaces(): PlaceResult[];
3387 setBounds(bounds: LatLngBounds | LatLngBoundsLiteral): void;
3388 }
3389
3390 interface SearchBoxOptions {
3391 bounds: LatLngBounds | LatLngBoundsLiteral;
3392 }
3393
3394 interface TextSearchRequest {
3395 bounds?: LatLngBounds | LatLngBoundsLiteral;
3396 location?: LatLng | LatLngLiteral;
3397 query: string;
3398 radius?: number;
3399 types?: string[] /* Deprecated. Will be removed February 16, 2017 */;
3400 type?: string;
3401 }
3402
3403 interface FindPlaceFromQueryRequest {
3404 fields: string[];
3405 locationBias?: LocationBias;
3406 query: string;
3407 }
3408
3409 interface FindPlaceFromPhoneNumberRequest {
3410 fields: string[];
3411 locationBias?: LocationBias;
3412 phoneNumber: string;
3413 }
3414 }
3415
3416 /***** Drawing Library *****/
3417 namespace drawing {
3418 class DrawingManager extends MVCObject {
3419 constructor(options?: DrawingManagerOptions);
3420 getDrawingMode(): OverlayType;
3421 getMap(): Map;
3422 setDrawingMode(drawingMode: OverlayType | null): void;
3423 setMap(map: Map | null): void;
3424 setOptions(options: DrawingManagerOptions): void;
3425 }
3426
3427 /** Options for the drawing manager. */
3428 interface DrawingManagerOptions {
3429 /**
3430 * Options to apply to any new circles created with this DrawingManager.
3431 * The center and radius properties are ignored, and the map property of a
3432 * new circle is always set to the DrawingManager's map.
3433 */
3434 circleOptions?: CircleOptions;
3435 /**
3436 * The enabled/disabled state of the drawing control. Defaults to true.
3437 */
3438 drawingControl?: boolean;
3439 /** The display options for the drawing control. */
3440 drawingControlOptions?: DrawingControlOptions;
3441 /**
3442 * The DrawingManager's drawing mode, which defines the type of overlay to
3443 * be added on the map. Accepted values are 'marker', 'polygon',
3444 * 'polyline', 'rectangle', 'circle', or null. A drawing mode of null
3445 * means that the user can interact with the map as normal, and clicks do
3446 * not draw anything.
3447 */
3448 drawingMode?: OverlayType | null;
3449 /**
3450 * The Map to which the DrawingManager is attached, which is the Map on
3451 * which the overlays created will be placed.
3452 */
3453 map?: Map;
3454 /**
3455 * Options to apply to any new markers created with this DrawingManager.
3456 * The position property is ignored, and the map property of a new marker
3457 * is always set to the DrawingManager's map.
3458 */
3459 markerOptions?: MarkerOptions;
3460 /**
3461 * Options to apply to any new polygons created with this DrawingManager.
3462 * The paths property is ignored, and the map property of a new polygon is
3463 * always set to the DrawingManager's map.
3464 */
3465 polygonOptions?: PolygonOptions;
3466 /**
3467 * Options to apply to any new polylines created with this DrawingManager.
3468 * The path property is ignored, and the map property of a new polyline is
3469 * always set to the DrawingManager's map.
3470 */
3471 polylineOptions?: PolylineOptions;
3472 /**
3473 * Options to apply to any new rectangles created with this
3474 * DrawingManager. The bounds property is ignored, and the map property of
3475 * a new rectangle is always set to the DrawingManager's map.
3476 */
3477 rectangleOptions?: RectangleOptions;
3478 }
3479
3480 interface DrawingControlOptions {
3481 drawingModes?: OverlayType[];
3482 position?: ControlPosition;
3483 }
3484
3485 /** The properties of an overlaycomplete event on a DrawingManager.. */
3486 interface OverlayCompleteEvent {
3487 /** The completed overlay. */
3488 overlay: Marker | Polygon | Polyline | Rectangle | Circle;
3489 /** The completed overlay's type. */
3490 type: OverlayType;
3491 }
3492
3493 /**
3494 * The types of overlay that may be created by the DrawingManager. Specify
3495 * these by value, or by using the constant's name. For example, 'polygon'
3496 * or google.maps.drawing.OverlayType.POLYGON.
3497 */
3498 enum OverlayType {
3499 /**
3500 * Specifies that the DrawingManager creates circles, and that the overlay
3501 * given in the overlaycomplete event is a circle.
3502 */
3503 CIRCLE = 'circle',
3504 /**
3505 * Specifies that the DrawingManager creates markers, and that the overlay
3506 * given in the overlaycomplete event is a marker.
3507 */
3508 MARKER = 'marker',
3509 /**
3510 * Specifies that the DrawingManager creates polygons, and that the
3511 * overlay given in the overlaycomplete event is a polygon.
3512 */
3513 POLYGON = 'polygon',
3514 /**
3515 * Specifies that the DrawingManager creates polylines, and that the
3516 * overlay given in the overlaycomplete event is a polyline.
3517 */
3518 POLYLINE = 'polyline',
3519 /**
3520 * Specifies that the DrawingManager creates rectangles, and that the
3521 * overlay given in the overlaycomplete event is a rectangle.
3522 */
3523 RECTANGLE = 'rectangle',
3524 }
3525 }
3526
3527 /***** Visualization Library *****/
3528 namespace visualization {
3529 class MapsEngineLayer extends MVCObject {
3530 constructor(options: MapsEngineLayerOptions);
3531 getLayerId(): string;
3532 getLayerKey(): string;
3533 getMap(): Map;
3534 getMapId(): string;
3535 getOpacity(): number;
3536 getProperties(): MapsEngineLayerProperties;
3537 getStatus(): MapsEngineStatus;
3538 getZIndex(): number;
3539 setLayerId(layerId: string): void;
3540 setLayerKey(layerKey: string): void;
3541 setMap(map: Map | null): void;
3542 setMapId(mapId: string): void;
3543 setOpacity(opacity: number): void;
3544 setOptions(options: MapsEngineLayerOptions): void;
3545 setZIndex(zIndex: number): void;
3546 }
3547
3548 interface MapsEngineLayerOptions {
3549 accessToken?: string;
3550 clickable?: boolean;
3551 fitBounds?: boolean;
3552 layerId?: string;
3553 layerKey?: string;
3554 map?: Map;
3555 mapId?: string;
3556 opacity?: number;
3557 suppressInfoWindows?: boolean;
3558 zIndex?: number;
3559 }
3560
3561 interface MapsEngineLayerProperties {
3562 name: string;
3563 }
3564
3565 interface MapsEngineMouseEvent {
3566 featureId?: string;
3567 infoWindowHtml?: string;
3568 latLng?: LatLng;
3569 pixelOffset?: Size;
3570 }
3571
3572 enum MapsEngineStatus {
3573 INVALID_LAYER = 'INVALID_LAYER',
3574 OK = 'OK',
3575 UNKNOWN_ERROR = 'UNKNOWN_ERROR',
3576 }
3577
3578 class HeatmapLayer extends MVCObject {
3579 constructor(opts?: HeatmapLayerOptions);
3580 getData(): MVCArray<LatLng | WeightedLocation>;
3581 getMap(): Map;
3582 setData(data: MVCArray<LatLng | WeightedLocation> | LatLng[] | WeightedLocation[]): void;
3583 setMap(map: Map | null): void;
3584 setOptions(options: HeatmapLayerOptions): void;
3585 }
3586
3587 interface HeatmapLayerOptions {
3588 data: any;
3589 dissipating?: boolean;
3590 gradient?: string[];
3591 map?: Map;
3592 maxIntensity?: number;
3593 opacity?: number;
3594 radius?: number;
3595 }
3596
3597 interface WeightedLocation {
3598 location: LatLng;
3599 weight: number;
3600 }
3601
3602 class MouseEvent {
3603 stop(): void;
3604 }
3605
3606 class MapsEventListener {}
3607 }
3608}