@types/google.maps
Version:
TypeScript definitions for google.maps
1,315 lines (1,312 loc) • 644 kB
TypeScript
// To report an issue with these types, please open a support ticket at:
// https://issuetracker.google.com/savedsearches/558438
// Google Maps JS API Version: 3.58
// tslint:disable:enforce-name-casing
// tslint:disable:no-any
// tslint:disable:interface-over-type-literal
// tslint:disable:array-type
// tslint:disable:no-empty-interface
// tslint:disable:no-unnecessary-class
// tslint:disable:strict-export-declare-modifiers
// Generated by an automated process. DO NOT EDIT!
declare namespace google.maps {
/**
* Available only in the v=beta channel: https://goo.gle/3oAthT3.
*
* A relational description of a location. Includes a ranked set of nearby
* landmarks and the areas containing the target location.
*/
export interface AddressDescriptor {
/**
* A ranked list of containing or adjacent areas. The most useful
* (recognizable and precise) areas are ranked first.
*/
areas: google.maps.Area[];
/**
* A ranked list of nearby landmarks. The most useful (recognizable and
* nearby) landmarks are ranked first.
*/
landmarks: google.maps.Landmark[];
}
/**
* Animations that can be played on a marker. Use the {@link
* google.maps.Marker.setAnimation} method on Marker or the {@link
* google.maps.MarkerOptions.animation} option to play an animation.
*
* Access by calling `const {Animation} = await
* google.maps.importLibrary("marker")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum Animation {
/**
* Marker bounces until animation is stopped by calling {@link
* google.maps.Marker.setAnimation} with <code>null</code>.
*/
BOUNCE = 0.0,
/**
* Marker drops from the top of the map to its final location. Animation
* will cease once the marker comes to rest and {@link
* google.maps.Marker.getAnimation} will return <code>null</code>. This type
* of animation is usually specified during creation of the marker.
*/
DROP = 1.0,
}
/**
* Available only in the v=beta channel: https://goo.gle/3oAthT3.
*
* A place that is a small region, such as a neighborhood, sublocality, or
* large complex that contains the target location.
*/
export interface Area {
/**
* Defines the spatial relationship between the target location and the
* area.
*/
containment: google.maps.Containment;
/**
* The name for the area.
*/
display_name: string;
/**
* The language of the name for the area.
*/
display_name_language_code: string;
/**
* The Place ID of the underlying area. Can be used to resolve more
* information about the area through Place Details or Place ID Lookup.
*/
place_id: string;
}
/**
* A layer showing bike lanes and paths.
*
* Access by calling `const {BicyclingLayer} = await
* google.maps.importLibrary("maps")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export class BicyclingLayer extends google.maps.MVCObject {
/**
* Returns the map on which this layer is displayed.
*/
getMap(): google.maps.Map | null;
/**
* Renders the layer on the specified map. If map is set to
* <code>null</code>, the layer will be removed.
*/
setMap(map: google.maps.Map | null): void;
}
/**
* The display options for the Camera control.
*/
export interface CameraControlOptions {
/**
* Position id. Used to specify the position of the control on the map.
* @defaultValue {@link google.maps.ControlPosition.INLINE_START_BLOCK_END}
*/
position?: google.maps.ControlPosition | null;
}
/**
* Available only in the v=beta channel: https://goo.gle/3oAthT3.
*
* Used for setting the map's camera options.
*/
export interface CameraOptions {
center?: google.maps.LatLngLiteral | google.maps.LatLng;
heading?: number;
tilt?: number;
zoom?: number;
}
/**
* Used for retrieving camera parameters, such as that of the GL camera used
* for the {@link google.maps.WebGLOverlayView}.
*/
export interface CameraParams extends google.maps.CameraOptions {
center: google.maps.LatLng;
heading: number;
tilt: number;
zoom: number;
}
/**
* A circle on the Earth's surface; also known as a "spherical
* cap".
*
* Access by calling `const {Circle} = await
* google.maps.importLibrary("maps")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export class Circle extends google.maps.MVCObject {
/**
* A circle on the Earth's surface; also known as a "spherical
* cap".
*
* Access by calling `const {Circle} = await
* google.maps.importLibrary("maps")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
constructor(
circleOrCircleOptions?:
| google.maps.Circle
| null
| google.maps.CircleLiteral
| google.maps.CircleOptions,
);
/**
* Gets the <code>LatLngBounds</code> of this Circle.
*/
getBounds(): google.maps.LatLngBounds | null;
/**
* Returns the center of this circle.
*/
getCenter(): google.maps.LatLng | null;
/**
* Returns whether this circle can be dragged by the user.
*/
getDraggable(): boolean;
/**
* Returns whether this circle can be edited by the user.
*/
getEditable(): boolean;
/**
* Returns the map on which this circle is displayed.
*/
getMap(): google.maps.Map | null;
/**
* Returns the radius of this circle (in meters).
*/
getRadius(): number;
/**
* Returns whether this circle is visible on the map.
*/
getVisible(): boolean;
/**
* Sets the center of this circle.
*/
setCenter(
center: google.maps.LatLng | null | google.maps.LatLngLiteral,
): void;
/**
* If set to <code>true</code>, the user can drag this circle over the map.
*/
setDraggable(draggable: boolean): void;
/**
* If set to <code>true</code>, the user can edit this circle by dragging
* the control points shown at the center and around the circumference of
* the circle.
*/
setEditable(editable: boolean): void;
/**
* Renders the circle on the specified map. If map is set to
* <code>null</code>, the circle will be removed.
*/
setMap(map: google.maps.Map | null): void;
setOptions(options: google.maps.CircleOptions | null): void;
/**
* Sets the radius of this circle (in meters).
*/
setRadius(radius: number): void;
/**
* Hides this circle if set to <code>false</code>.
*/
setVisible(visible: boolean): void;
}
/**
* Object literal which represents a circle.
*/
export interface CircleLiteral extends google.maps.CircleOptions {
/**
* The center of the Circle.
*/
center: google.maps.LatLng | google.maps.LatLngLiteral;
/**
* The radius in meters on the Earth's surface.
*/
radius: number;
}
/**
* CircleOptions object used to define the properties that can be set on a
* Circle.
*/
export interface CircleOptions {
/**
* The center of the Circle.
*/
center?: google.maps.LatLng | google.maps.LatLngLiteral | null;
/**
* Indicates whether this <code>Circle</code> handles mouse events.
* @defaultValue <code>true</code>
*/
clickable?: boolean | null;
/**
* If set to <code>true</code>, the user can drag this circle over the map.
* @defaultValue <code>false</code>
*/
draggable?: boolean | null;
/**
* If set to <code>true</code>, the user can edit this circle by dragging
* the control points shown at the center and around the circumference of
* the circle.
* @defaultValue <code>false</code>
*/
editable?: boolean | null;
/**
* The fill color. All CSS3 colors are supported except for extended named
* colors.
*/
fillColor?: string | null;
/**
* The fill opacity between 0.0 and 1.0.
*/
fillOpacity?: number | null;
/**
* Map on which to display the Circle.
*/
map?: google.maps.Map | null;
/**
* The radius in meters on the Earth's surface.
*/
radius?: number | null;
/**
* The stroke color. All CSS3 colors are supported except for extended named
* colors.
*/
strokeColor?: string | null;
/**
* The stroke opacity between 0.0 and 1.0.
*/
strokeOpacity?: number | null;
/**
* The stroke position.
* @defaultValue {@link google.maps.StrokePosition.CENTER}
*/
strokePosition?: google.maps.StrokePosition | null;
/**
* The stroke width in pixels.
*/
strokeWeight?: number | null;
/**
* Whether this circle is visible on the map.
* @defaultValue <code>true</code>
*/
visible?: boolean | null;
/**
* The zIndex compared to other polys.
*/
zIndex?: number | null;
}
/**
* Access by calling `const {CollisionBehavior} = await
* google.maps.importLibrary("marker")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum CollisionBehavior {
/**
* Display the marker only if it does not overlap with other markers. If two
* markers of this type would overlap, the one with the higher zIndex is
* shown. If they have the same zIndex, the one with the lower vertical
* screen position is shown.
*/
OPTIONAL_AND_HIDES_LOWER_PRIORITY = 'OPTIONAL_AND_HIDES_LOWER_PRIORITY',
/**
* Always display the marker regardless of collision. This is the default
* behavior.
*/
REQUIRED = 'REQUIRED',
/**
* Always display the marker regardless of collision, and hide any
* OPTIONAL_AND_HIDES_LOWER_PRIORITY markers or labels that would overlap
* with the marker.
*/
REQUIRED_AND_HIDES_OPTIONAL = 'REQUIRED_AND_HIDES_OPTIONAL',
}
/**
* Identifiers for map color schemes. Specify these by value, or by using the
* constant's name. For example, <code>'FOLLOW_SYSTEM'</code> or
* <code>google.maps.ColorScheme.FOLLOW_SYSTEM</code>.
*
* Access by calling `const {ColorScheme} = await
* google.maps.importLibrary("core")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum ColorScheme {
/**
* The dark color scheme for a map.
*/
DARK = 'DARK',
/**
* The color scheme is selected based on system preferences.
*/
FOLLOW_SYSTEM = 'FOLLOW_SYSTEM',
/**
* The light color scheme for a map. Default value for legacy Maps JS.
*/
LIGHT = 'LIGHT',
}
/**
* Available only in the v=beta channel: https://goo.gle/3oAthT3.
*
* An enum representing the spatial relationship between the area and the
* target location.
*
* Access by calling `const {Containment} = await
* google.maps.importLibrary("geocoding")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum Containment {
/**
* The target location is outside the area region, but close by.
*/
NEAR = 'NEAR',
/**
* The target location is within the area region, close to the edge.
*/
OUTSKIRTS = 'OUTSKIRTS',
/**
* The target location is within the area region, close to the center.
*/
WITHIN = 'WITHIN',
}
/**
* Identifiers used to specify the placement of controls on the map. Controls
* are positioned relative to other controls in the same layout position.
* Controls that are added first are positioned closer to the edge of the map.
* Usage of "logical values" (see <a
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values">https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values</a>)
* is recommended in order to be able to automatically support both
* left-to-right (LTR) and right-to-left (RTL) layout contexts.<br>
* <br>Logical values in LTR: <br> <pre>+----------------+
* <br>| BSIS BSIC BSIE |
* <br>| ISBS IEBS |
* <br>| |
* <br>| ISBC IEBC |
* <br>| |
* <br>| ISBE IEBE |
* <br>| BEIS BEIC BEIE | <br>+----------------+</pre><br>
* Logical values in RTL:<br> <pre>+----------------+
* <br>| BSIE BSIC BSIS |
* <br>| IEBS ISBS |
* <br>| |
* <br>| IEBC ISBC |
* <br>| |
* <br>| IEBE ISBE |
* <br>| BEIE BEIC BEIS | <br>+----------------+</pre><br>
* Legacy values:<br> <pre>+----------------+
* <br>| TL TC TR |
* <br>| LT RT
* |
* <br>| |
* <br>| LC RC
* |
* <br>| |
* <br>| LB RB
* | <br>| BL BC BR |
* <br>+----------------+</pre><br> Elements in the top or bottom row flow
* towards the middle of the row. Elements in the left or right column flow
* towards the middle of the column.
*
* Access by calling `const {ControlPosition} = await
* google.maps.importLibrary("core")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum ControlPosition {
/**
* Equivalent to BOTTOM_CENTER in both LTR and RTL.
*/
BLOCK_END_INLINE_CENTER = 0.0,
/**
* Equivalent to BOTTOM_RIGHT in LTR, or BOTTOM_LEFT in RTL.
*/
BLOCK_END_INLINE_END = 1.0,
/**
* Equivalent to BOTTOM_LEFT in LTR, or BOTTOM_RIGHT in RTL.
*/
BLOCK_END_INLINE_START = 2.0,
/**
* Equivalent to TOP_CENTER in both LTR and RTL.
*/
BLOCK_START_INLINE_CENTER = 3.0,
/**
* Equivalent to TOP_RIGHT in LTR, or TOP_LEFT in RTL.
*/
BLOCK_START_INLINE_END = 4.0,
/**
* Equivalent to TOP_LEFT in LTR, or TOP_RIGHT in RTL.
*/
BLOCK_START_INLINE_START = 5.0,
/**
* Elements are positioned in the center of the bottom row. Consider using
* BLOCK_END_INLINE_CENTER instead.
*/
BOTTOM_CENTER = 6.0,
/**
* Elements are positioned in the bottom left and flow towards the middle.
* Elements are positioned to the right of the Google logo. Consider using
* BLOCK_END_INLINE_START instead.
*/
BOTTOM_LEFT = 7.0,
/**
* Elements are positioned in the bottom right and flow towards the middle.
* Elements are positioned to the left of the copyrights. Consider using
* BLOCK_END_INLINE_END instead.
*/
BOTTOM_RIGHT = 8.0,
/**
* Equivalent to RIGHT_CENTER in LTR, or LEFT_CENTER in RTL.
*/
INLINE_END_BLOCK_CENTER = 9.0,
/**
* Equivalent to RIGHT_BOTTOM in LTR, or LEFT_BOTTOM in RTL.
*/
INLINE_END_BLOCK_END = 10.0,
/**
* Equivalent to RIGHT_TOP in LTR, or LEFT_TOP in RTL.
*/
INLINE_END_BLOCK_START = 11.0,
/**
* Equivalent to LEFT_CENTER in LTR, or RIGHT_CENTER in RTL.
*/
INLINE_START_BLOCK_CENTER = 12.0,
/**
* Equivalent to LEFT_BOTTOM in LTR, or RIGHT_BOTTOM in RTL.
*/
INLINE_START_BLOCK_END = 13.0,
/**
* Equivalent to LEFT_TOP in LTR, or RIGHT_TOP in RTL.
*/
INLINE_START_BLOCK_START = 14.0,
/**
* Elements are positioned on the left, above bottom-left elements, and flow
* upwards. Consider using INLINE_START_BLOCK_END instead.
*/
LEFT_BOTTOM = 15.0,
/**
* Elements are positioned in the center of the left side. Consider using
* INLINE_START_BLOCK_CENTER instead.
*/
LEFT_CENTER = 16.0,
/**
* Elements are positioned on the left, below top-left elements, and flow
* downwards. Consider using INLINE_START_BLOCK_START instead.
*/
LEFT_TOP = 17.0,
/**
* Elements are positioned on the right, above bottom-right elements, and
* flow upwards. Consider using INLINE_END_BLOCK_END instead.
*/
RIGHT_BOTTOM = 18.0,
/**
* Elements are positioned in the center of the right side. Consider using
* INLINE_END_BLOCK_CENTER instead.
*/
RIGHT_CENTER = 19.0,
/**
* Elements are positioned on the right, below top-right elements, and flow
* downwards. Consider using INLINE_END_BLOCK_START instead.
*/
RIGHT_TOP = 20.0,
/**
* Elements are positioned in the center of the top row. Consider using
* BLOCK_START_INLINE_CENTER instead.
*/
TOP_CENTER = 21.0,
/**
* Elements are positioned in the top left and flow towards the middle.
* Consider using BLOCK_START_INLINE_START instead.
*/
TOP_LEFT = 22.0,
/**
* Elements are positioned in the top right and flow towards the middle.
* Consider using BLOCK_START_INLINE_END instead.
*/
TOP_RIGHT = 23.0,
}
/**
* This interface provides convenience methods for generating matrices to use
* for rendering WebGL scenes on top of the Google base map. <br><br>Note: A
* reference to this object should <b>not</b> be held outside of the scope of
* the encapsulating {@link google.maps.WebGLOverlayView.onDraw} call.
*/
export interface CoordinateTransformer {
/**
* @param latLngAltitude Latitude, longitude, and altitude.
* @param rotations An array that contains an Euler rotation angle in
* degrees, in the XYZ convention.
* @param scale Array that contains an XYZ scalar array to apply to the
* cardinal axis.
*/
fromLatLngAltitude(
latLngAltitude:
| google.maps.LatLngAltitude
| google.maps.LatLngAltitudeLiteral,
rotations?: Float32Array,
scale?: Float32Array,
): Float64Array;
getCameraParams(): google.maps.CameraParams;
}
export interface CoreLibrary {
ColorScheme: typeof google.maps.ColorScheme;
ControlPosition: typeof google.maps.ControlPosition;
event: typeof google.maps.event;
LatLng: typeof google.maps.LatLng;
LatLngAltitude: typeof google.maps.LatLngAltitude;
LatLngBounds: typeof google.maps.LatLngBounds;
MapsNetworkError: typeof google.maps.MapsNetworkError;
MapsNetworkErrorEndpoint: typeof google.maps.MapsNetworkErrorEndpoint;
MapsRequestError: typeof google.maps.MapsRequestError;
MapsServerError: typeof google.maps.MapsServerError;
MVCArray: typeof google.maps.MVCArray;
MVCObject: typeof google.maps.MVCObject;
Point: typeof google.maps.Point;
Settings: typeof google.maps.Settings;
Size: typeof google.maps.Size;
SymbolPath: typeof google.maps.SymbolPath;
UnitSystem: typeof google.maps.UnitSystem;
}
/**
* A layer for displaying geospatial data. Points, line-strings and polygons
* can be displayed. <p> Every <code>Map</code> has a <code>Data</code> object
* by default, so most of the time there is no need to construct one. For
* example: <pre> var myMap = new google.maps.Map(...);<br>
* myMap.data.addGeoJson(...);<br> myMap.data.setStyle(...); </pre> The
* <code>Data</code> object is a collection of <a
* href="#Data.Feature"><code>Features</code></a>.
*
* Access by calling `const {Data} = await google.maps.importLibrary("maps")`.
* See https://developers.google.com/maps/documentation/javascript/libraries.
*/
export class Data extends google.maps.MVCObject {
/**
* A layer for displaying geospatial data. Points, line-strings and polygons
* can be displayed. <p> Every <code>Map</code> has a <code>Data</code>
* object by default, so most of the time there is no need to construct one.
* For example: <pre> var myMap = new google.maps.Map(...);<br>
* myMap.data.addGeoJson(...);<br> myMap.data.setStyle(...); </pre> The
* <code>Data</code> object is a collection of <a
* href="#Data.Feature"><code>Features</code></a>.
*
* Access by calling `const {Data} = await
* google.maps.importLibrary("maps")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
constructor(options?: google.maps.Data.DataOptions | null);
/**
* Adds a feature to the collection, and returns the added feature. <p> If
* the feature has an ID, it will replace any existing feature in the
* collection with the same ID. If no feature is given, a new feature will
* be created with null geometry and no properties. If
* <code>FeatureOptions</code> are given, a new feature will be created with
* the specified properties. <p> Note that the IDs <code>1234</code> and
* <code>'1234'</code> are equivalent. Adding a feature with ID
* <code>1234</code> will replace a feature with ID <code>'1234'</code>, and
* vice versa.
*/
add(
feature?:
| google.maps.Data.Feature
| null
| google.maps.Data.FeatureOptions,
): google.maps.Data.Feature;
/**
* Adds GeoJSON features to the collection. Give this method a parsed JSON.
* The imported features are returned. Throws an exception if the GeoJSON
* could not be imported.
*/
addGeoJson(
geoJson: object,
options?: google.maps.Data.GeoJsonOptions | null,
): google.maps.Data.Feature[];
/**
* Checks whether the given feature is in the collection.
*/
contains(feature: google.maps.Data.Feature): boolean;
/**
* Repeatedly invokes the given function, passing a feature in the
* collection to the function on each invocation. The order of iteration
* through the features is undefined.
*/
forEach(callback: (a: google.maps.Data.Feature) => void): void;
/**
* Returns the position of the drawing controls on the map.
*/
getControlPosition(): google.maps.ControlPosition;
/**
* Returns which drawing modes are available for the user to select, in the
* order they are displayed. This does not include the <code>null</code>
* drawing mode, which is added by default. Possible drawing modes are
* <code>"Point"</code>, <code>"LineString"</code> or
* <code>"Polygon"</code>.
*/
getControls(): string[] | null;
/**
* Returns the current drawing mode of the given Data layer. A drawing mode
* of <code>null</code> means that the user can interact with the map as
* normal, and clicks do not draw anything. Possible drawing modes are
* <code>null</code>, <code>"Point"</code>, <code>"LineString"</code> or
* <code>"Polygon"</code>.
*/
getDrawingMode(): string | null;
/**
* Returns the feature with the given ID, if it exists in the collection.
* Otherwise returns <code>undefined</code>. <p> Note that the IDs
* <code>1234</code> and <code>'1234'</code> are equivalent. Either can be
* used to look up the same feature.
*/
getFeatureById(id: number | string): google.maps.Data.Feature | undefined;
/**
* Returns the map on which the features are displayed.
*/
getMap(): google.maps.Map | null;
/**
* Gets the style for all features in the collection.
*/
getStyle():
| google.maps.Data.StylingFunction
| google.maps.Data.StyleOptions
| null;
/**
* Loads GeoJSON from a URL, and adds the features to the collection. <p>
* NOTE: The GeoJSON is fetched using XHR, and may not work cross-domain. If
* you have issues, we recommend you fetch the GeoJSON using your choice of
* AJAX library, and then call <code>addGeoJson()</code>.
*/
loadGeoJson(
url: string,
options?: google.maps.Data.GeoJsonOptions | null,
callback?: (a: google.maps.Data.Feature[]) => void,
): void;
/**
* Changes the style of a feature. These changes are applied on top of the
* style specified by <code>setStyle()</code>. Style properties set to
* <code>null</code> revert to the value specified via
* <code>setStyle()</code>.
*/
overrideStyle(
feature: google.maps.Data.Feature,
style: google.maps.Data.StyleOptions,
): void;
/**
* Removes a feature from the collection.
*/
remove(feature: google.maps.Data.Feature): void;
/**
* Removes the effect of previous <code>overrideStyle()</code> calls. The
* style of the given feature reverts to the style specified by
* <code>setStyle()</code>. <p>If no feature is given, all features have
* their style reverted.</p>
*/
revertStyle(feature?: google.maps.Data.Feature | null): void;
/**
* Sets the position of the drawing controls on the map.
*/
setControlPosition(controlPosition: google.maps.ControlPosition): void;
/**
* Sets which drawing modes are available for the user to select, in the
* order they are displayed. This should not include the <code>null</code>
* drawing mode, which is added by default. If <code>null</code>, drawing
* controls are disabled and not displayed. Possible drawing modes are
* <code>"Point"</code>, <code>"LineString"</code> or
* <code>"Polygon"</code>.
*/
setControls(controls: string[] | null): void;
/**
* Sets the current drawing mode of the given Data layer. A drawing mode of
* <code>null</code> means that the user can interact with the map as
* normal, and clicks do not draw anything. Possible drawing modes are
* <code>null</code>, <code>"Point"</code>, <code>"LineString"</code> or
* <code>"Polygon"</code>.
*/
setDrawingMode(drawingMode: string | null): void;
/**
* Renders the features on the specified map. If map is set to
* <code>null</code>, the features will be removed from the map.
*/
setMap(map: google.maps.Map | null): void;
/**
* Sets the style for all features in the collection. Styles specified on a
* per-feature basis via <code>overrideStyle()</code> continue to apply.
* <p>Pass either an object with the desired style options, or a function
* that computes the style for each feature. The function will be called
* every time a feature's properties are updated.
*/
setStyle(
style:
| google.maps.Data.StylingFunction
| google.maps.Data.StyleOptions
| null,
): void;
/**
* Exports the features in the collection to a GeoJSON object.
*/
toGeoJson(callback: (a: object) => void): void;
}
/**
* Available only in the v=beta channel: https://goo.gle/3oAthT3.
*
* An interface representing a feature from a Dataset. The
* <code>featureType</code> of a <code>DatasetFeature</code> will always be
* <code>FeatureType.DATASET</code>.
*/
export interface DatasetFeature extends google.maps.Feature {
/**
* Key-value mapping of the feature's attributes.
*/
datasetAttributes: {[key: string]: string};
/**
* Dataset id of the dataset that this feature belongs to.
*/
datasetId: string;
}
/**
* A single geocoded waypoint.
*/
export interface DirectionsGeocodedWaypoint {
/**
* Whether the geocoder did not return an exact match for the original
* waypoint, though it was able to match part of the requested address.
*/
partial_match?: boolean;
/**
* The place ID associated with the waypoint. Place IDs uniquely identify a
* place in the Google Places database and on Google Maps. Learn more about
* <a
* href="https://developers.google.com/maps/documentation/places/web-service/place-id">Place
* IDs</a> in the Places API developer guide.
*/
place_id?: string;
/**
* An array of strings denoting the type of the returned geocoded element.
* For a list of possible strings, refer to the <a href=
* "https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes">
* Address Component Types</a> section of the Developer's Guide.
*/
types?: string[];
}
/**
* A single leg consisting of a set of steps in a <code><a
* href="#DirectionsResult">DirectionsResult</a></code>. Some fields in the
* leg may not be returned for all requests. Note that though this result is
* "JSON-like," it is not strictly JSON, as it directly and
* indirectly includes <code>LatLng</code> objects.
*/
export interface DirectionsLeg {
/**
* An estimated arrival time for this leg. Only applicable for TRANSIT
* requests.
*/
arrival_time?: google.maps.Time;
/**
* An estimated departure time for this leg. Only applicable for TRANSIT
* requests.
*/
departure_time?: google.maps.Time;
/**
* The total distance covered by this leg. This property may be undefined as
* the distance may be unknown.
*/
distance?: google.maps.Distance;
/**
* The total duration of this leg. This property may be
* <code>undefined</code> as the duration may be unknown.
*/
duration?: google.maps.Duration;
/**
* The total duration of this leg, taking into account the traffic
* conditions indicated by the <code>trafficModel</code> property. This
* property may be <code>undefined</code> as the duration may be unknown.
*/
duration_in_traffic?: google.maps.Duration;
/**
* The address of the destination of this leg. This content is meant to be
* read as-is. Do not programmatically parse the formatted address.
*/
end_address: string;
/**
* The <code>DirectionsService</code> calculates directions between
* locations by using the nearest transportation option (usually a road) at
* the start and end locations. <code>end_location</code> indicates the
* actual geocoded destination, which may be different than the
* <code>end_location</code> of the last step if, for example, the road is
* not near the destination of this leg.
*/
end_location: google.maps.LatLng;
/**
* The address of the origin of this leg. This content is meant to be read
* as-is. Do not programmatically parse the formatted address.
*/
start_address: string;
/**
* The <code>DirectionsService</code> calculates directions between
* locations by using the nearest transportation option (usually a road) at
* the start and end locations. <code>start_location</code> indicates the
* actual geocoded origin, which may be different than the
* <code>start_location</code> of the first step if, for example, the road
* is not near the origin of this leg.
*/
start_location: google.maps.LatLng;
/**
* An array of <code>DirectionsStep</code>s, each of which contains
* information about the individual steps in this leg.
*/
steps: google.maps.DirectionsStep[];
/**
* Information about traffic speed along the leg.
* @deprecated This array will always be empty.
*/
traffic_speed_entry: any[];
/**
* An array of non-stopover waypoints along this leg, which were specified
* in the original request. <p> <strong>Deprecated in alternative
* routes</strong>. Version 3.27 will be the last version of the API that
* adds extra <code>via_waypoints</code> in alternative routes. <p> When
* using the Directions Service to implement draggable directions, it is
* recommended to disable dragging of alternative routes. Only the main
* route should be draggable. Users can drag the main route until it matches
* an alternative route.
*/
via_waypoints: google.maps.LatLng[];
}
/**
* An object containing a <code>points</code> property to describe the
* polyline of a {@link google.maps.DirectionsStep}.
*/
export interface DirectionsPolyline {
/**
* An <a
* href="https://developers.google.com/maps/documentation/utilities/polylinealgorithm">encoded
* polyline</a>.
*/
points: string;
}
/**
* Renders directions obtained from the <code><a
* href="#DirectionsService">DirectionsService</a></code>.
*
* Access by calling `const {DirectionsRenderer} = await
* google.maps.importLibrary("routes")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export class DirectionsRenderer extends google.maps.MVCObject {
/**
* Renders directions obtained from the <code><a
* href="#DirectionsService">DirectionsService</a></code>.
*
* Access by calling `const {DirectionsRenderer} = await
* google.maps.importLibrary("routes")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
constructor(opts?: google.maps.DirectionsRendererOptions | null);
/**
* Returns the renderer's current set of directions.
*/
getDirections(): google.maps.DirectionsResult | null;
/**
* Returns the map on which the <code>DirectionsResult</code> is rendered.
*/
getMap(): google.maps.Map | null;
/**
* Returns the panel <code><div></code> in which the
* <code>DirectionsResult</code> is rendered.
*/
getPanel(): HTMLElement | null;
/**
* Returns the current (zero-based) route index in use by this
* <code>DirectionsRenderer</code> object.
*/
getRouteIndex(): number;
/**
* Set the renderer to use the result from the
* <code>DirectionsService</code>. Setting a valid set of directions in this
* manner will display the directions on the renderer's designated map
* and panel.
*/
setDirections(directions: google.maps.DirectionsResult | null): void;
/**
* This method specifies the map on which directions will be rendered. Pass
* <code>null</code> to remove the directions from the map.
*/
setMap(map: google.maps.Map | null): void;
/**
* Change the options settings of this <code>DirectionsRenderer</code> after
* initialization.
*/
setOptions(options: google.maps.DirectionsRendererOptions | null): void;
/**
* This method renders the directions in a <code><div></code>. Pass
* <code>null</code> to remove the content from the panel.
*/
setPanel(panel: HTMLElement | null): void;
/**
* Set the (zero-based) index of the route in the
* <code>DirectionsResult</code> object to render. By default, the first
* route in the array will be rendered.
*/
setRouteIndex(routeIndex: number): void;
}
/**
* This object defines the properties that can be set on a
* <code>DirectionsRenderer</code> object.
*/
export interface DirectionsRendererOptions {
/**
* The directions to display on the map and/or in a <code><div></code>
* panel, retrieved as a <code>DirectionsResult</code> object from
* <code>DirectionsService</code>.
*/
directions?: google.maps.DirectionsResult | null;
/**
* If <code>true</code>, allows the user to drag and modify the paths of
* routes rendered by this <code>DirectionsRenderer</code>.
*/
draggable?: boolean | null;
/**
* This property indicates whether the renderer should provide a
* user-selectable list of routes shown in the directions panel.
* @defaultValue <code>false</code>
*/
hideRouteList?: boolean | null;
/**
* The <code>InfoWindow</code> in which to render text information when a
* marker is clicked. Existing info window content will be overwritten and
* its position moved. If no info window is specified, the
* <code>DirectionsRenderer</code> will create and use its own info window.
* This property will be ignored if <code>suppressInfoWindows</code> is set
* to <code>true</code>.
*/
infoWindow?: google.maps.InfoWindow | null;
/**
* Map on which to display the directions.
*/
map?: google.maps.Map | null;
/**
* Options for the markers. All markers rendered by the
* <code>DirectionsRenderer</code> will use these options.
*/
markerOptions?: google.maps.MarkerOptions | null;
/**
* The <code><div></code> in which to display the directions steps.
*/
panel?: HTMLElement | null;
/**
* Options for the polylines. All polylines rendered by the
* <code>DirectionsRenderer</code> will use these options.
*/
polylineOptions?: google.maps.PolylineOptions | null;
/**
* If this option is set to <code>true</code> or the map's center and
* zoom were never set, the input map is centered and zoomed to the bounding
* box of this set of directions.
* @defaultValue <code>false</code>
*/
preserveViewport?: boolean | null;
/**
* The index of the route within the <code>DirectionsResult</code> object.
* The default value is 0.
*/
routeIndex?: number | null;
/**
* Suppress the rendering of the <code>BicyclingLayer</code> when bicycling
* directions are requested.
*/
suppressBicyclingLayer?: boolean | null;
/**
* Suppress the rendering of info windows.
*/
suppressInfoWindows?: boolean | null;
/**
* Suppress the rendering of markers.
*/
suppressMarkers?: boolean | null;
/**
* Suppress the rendering of polylines.
*/
suppressPolylines?: boolean | null;
}
/**
* A directions query to be sent to the <code><a
* href="#DirectionsService">DirectionsService</a></code>.
*/
export interface DirectionsRequest {
/**
* If <code>true</code>, instructs the Directions service to avoid ferries
* where possible. Optional.
*/
avoidFerries?: boolean;
/**
* If <code>true</code>, instructs the Directions service to avoid highways
* where possible. Optional.
*/
avoidHighways?: boolean;
/**
* If <code>true</code>, instructs the Directions service to avoid toll
* roads where possible. Optional.
*/
avoidTolls?: boolean;
/**
* Location of destination. This can be specified as either a string to be
* geocoded, or a <code>LatLng</code>, or a <code>Place</code>. Required.
*/
destination:
| string
| google.maps.LatLng
| google.maps.Place
| google.maps.LatLngLiteral;
/**
* Settings that apply only to requests where <code>travelMode</code> is
* <code>DRIVING</code>. This object will have no effect for other travel
* modes.
*/
drivingOptions?: google.maps.DrivingOptions;
/**
* A language identifier for the language in which results should be
* returned, when possible. See the <a
* href="https://developers.google.com/maps/faq#languagesupport">list of
* supported languages</a>.
*/
language?: string | null;
/**
* If set to <code>true</code>, the <code>DirectionsService</code> will
* attempt to re-order the supplied intermediate waypoints to minimize
* overall cost of the route. If waypoints are optimized, inspect
* <code>DirectionsRoute.waypoint_order</code> in the response to determine
* the new ordering.
*/
optimizeWaypoints?: boolean;
/**
* Location of origin. This can be specified as either a string to be
* geocoded, or a <code>LatLng</code>, or a <code>Place</code>. Required.
*/
origin:
| string
| google.maps.LatLng
| google.maps.Place
| google.maps.LatLngLiteral;
/**
* Whether or not route alternatives should be provided. Optional.
*/
provideRouteAlternatives?: boolean;
/**
* Region code used as a bias for geocoding requests. The region code
* accepts a <a
* href="https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains">ccTLD
* ("top-level domain")</a> two-character value. Most ccTLD codes
* are identical to ISO 3166-1 codes, with some notable exceptions. For
* example, the United Kingdom's ccTLD is "uk"
* (<code>.co.uk</code>) while its ISO 3166-1 code is "gb"
* (technically for the entity of "The United Kingdom of Great Britain
* and Northern Ireland").
*/
region?: string | null;
/**
* Settings that apply only to requests where <code>travelMode</code> is
* TRANSIT. This object will have no effect for other travel modes.
*/
transitOptions?: google.maps.TransitOptions;
/**
* Type of routing requested. Required.
*/
travelMode: google.maps.TravelMode;
/**
* Preferred unit system to use when displaying distance.
* @defaultValue The unit system used in the country of origin.
*/
unitSystem?: google.maps.UnitSystem;
/**
* Array of intermediate waypoints. Directions are calculated from the
* origin to the destination by way of each waypoint in this array. See the
* <a
* href="https://developers.google.com/maps/documentation/javascript/directions#UsageLimits">
* developer's guide</a> for the maximum number of waypoints allowed.
* Waypoints are not supported for transit directions. Optional.
*/
waypoints?: google.maps.DirectionsWaypoint[];
}
/**
* The directions response retrieved from the directions server. You can
* render these using a {@link google.maps.DirectionsRenderer} or parse this
* object and render it yourself. You must display the warnings and copyrights
* as noted in the <a
* href="https://cloud.google.com/maps-platform/terms">Google Maps Platform
* Terms of Service</a>. Note that though this result is
* "JSON-like," it is not strictly JSON, as it indirectly includes
* <code>LatLng</code> objects.
*/
export interface DirectionsResult {
/**
* Contains an array of available travel modes. This field is returned when
* a request specifies a travel mode and gets no results. The array contains
* the available travel modes in the countries of the given set of
* waypoints. This field is not returned if one or more of the waypoints are
* 'via waypoints'.
*/
available_travel_modes?: google.maps.TravelMode[];
/**
* An array of <code>DirectionsGeocodedWaypoint</code>s, each of which
* contains information about the geocoding of origin, destination and
* waypoints.
*/
geocoded_waypoints?: google.maps.DirectionsGeocodedWaypoint[];
/**
* The DirectionsRequest that yielded this result.
*/
request: google.maps.DirectionsRequest;
/**
* An array of <code>DirectionsRoute</code>s, each of which contains
* information about the legs and steps of which it is composed. There will
* only be one route unless the <code>DirectionsRequest</code> was made with
* <code>provideRouteAlternatives</code> set to <code>true</code>.
*/
routes: google.maps.DirectionsRoute[];
}
/**
* A single route containing a set of legs in a <code><a
* href="#DirectionsResult">DirectionsResult</a></code>. Note that though this
* object is "JSON-like," it is not strictly JSON, as it directly
* and indirectly includes <code>LatLng</code> objects.
*/
export interface DirectionsRoute {
/**
* The bounds for this route.
*/
bounds: google.maps.LatLngBounds;
/**
* Copyrights text to be displayed for this route.
*/
copyrights: string;
/**
* The total fare for the whole transit trip. Only applicable to transit
* requests.
*/
fare?: google.maps.TransitFare;
/**
* An array of <code>DirectionsLeg</code>s, each of which contains
* information about the steps of which it is composed. There will be one
* leg for each stopover waypoint or destination specified. So a route with
* no stopover waypoints will contain one <code>DirectionsLeg</code> and a
* route with one stopover waypoint will contain two.
*/
legs: google.maps.DirectionsLeg[];
/**
* An array of <code>LatLng</code>s representing the entire course of this
* route. The path is simplified in order to make it suitable in contexts
* where a small number of vertices is required (such as Static Maps API
* URLs).
*/
overview_path: google.maps.LatLng[];
/**
* An <a
* href="https://developers.google.com/maps/documentation/utilities/polylinealgorithm">encoded
* polyline representation</a> of the route in overview_path. This polyline
* is an approximate (smoothed) path of the resulting directions.
*/
overview_polyline: string;
/**
* Contains a short textual description for the route, suitable for naming
* and disambiguating the route from alternatives.
*/
summary: string;
/**
* Warnings to be displayed when showing these directions.
*/
warnings: string[];
/**
* If <code>optimizeWaypoints</code> was set to <code>true</code>, this
* field will contain the re-ordered permutation of the input waypoints. For
* example, if the input was:<br> Origin: Los Angeles<br>
* Waypoints: Dallas, Bangor, Phoenix<br>
* Destination: New York<br> and the optimized output was
* ordered as follows:<br> Origin: Los Angeles<br>
* Waypoints: Phoenix, Dallas, Bangor<br>
* Destination: New York<br> then this field will be an
* <code>Array</code> containing the values [2, 0, 1]. Note that the
* numbering of waypoints is zero-based.<br> If any of the input waypoints
* has <code>stopover</code> set to <code>false</code>, this field will be
* empty, since route optimization is not available for such queries.
*/
waypoint_order: number[];
}
/**
* A service for computing directions between two or more places.
*
* Access by calling `const {DirectionsService} = await
* google.maps.importLibrary("routes")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export class DirectionsService {
/**
* Issue a directions search request.
*/
route(
request: google.maps.DirectionsRequest,
callback?: (
a: google.maps.DirectionsResult | null,
b: google.maps.DirectionsStatus,
) => void,
): Promise<google.maps.DirectionsResult>;
}
/**
* The status returned by the <code>DirectionsService</code> on the completion
* of a call to <code>route()</code>. Specify these by value, or by using the
* constant's name. For example, <code>'OK'</code> or
* <code>google.maps.DirectionsStatus.OK</code>.
*
* Access by calling `const {DirectionsStatus} = await
* google.maps.importLibrary("routes")`. See
* https://developers.google.com/maps/documentation/javascript/libraries.
*/
export enum DirectionsStatus {
/**
* The <code>DirectionsRequest</code> provided was invalid.
*/
INVALID_REQUEST = 'INVALID_REQUEST',
/**
* Too many <code>DirectionsWaypoint</code>s were provided in the
* <code>DirectionsRequest</code>. See the <a
* href="https://developers.google.com/maps/documentation/javascript/directions#UsageLimits">
* developer's guide</a> for the maximum number of waypoints allowed.
*/
MAX_WAYPOINTS_EXCEEDED = 'MAX_WAYPOINTS_EXCEEDED',
/**
* At least one of the origin, destination, or waypoints could not be
* geocoded.
*/
NOT_FOUND = 'NOT_FOUND',
/**
* The response contains a valid <code>DirectionsResult</code>.
*/
OK = 'OK',
/**
* The webpage has gone over the requests limit in too short a period of
* time.
*/
OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
/**
* The webpage is not allowed to use the directions service.
*/
REQUEST_DENIED = 'REQUEST_DENIED',
/**
* A directions request could not be processed due to a server error. The
* request may succeed if you try again.
*/
UNKNOWN_ERROR = 'UNKNOWN_ERROR',
/**
* No route could be found between the origin and destination.
*/
ZERO_RESULTS = 'ZERO_RESULTS',
}
/**
* A single <code>DirectionsStep</code> in a <code>DirectionsResult</code>.
* Some fields may be <code>undefined</code>. Note that though this object is
* "JSON-like," it is not strictly JSON, as it directly includes
* <code>LatLng</code> objects.
*/
export interface DirectionsStep {
/**
* The distance covered by this step. This property may be
* <code>undefined</code> as the distance may be unknown.
*/
distance?: google.maps.Distance;
/**
* The typical time required to perform this step in seconds and in text
* form. This property may be <code>undefined</code> as the duration may be
* unknown.
*/
d