UNPKG

3.04 kBTypeScriptView Raw
1declare namespace google.maps.geometry {
2 namespace encoding {
3 function decodePath(encodedPath: string): LatLng[];
4
5 function encodePath(path: LatLng[] | MVCArray<LatLng>): string;
6 }
7
8 /**
9 * Utility functions for computing geodesic angles, distances and areas.
10 * The default radius is Earth's radius of 6378137 meters.
11 */
12 namespace spherical {
13 /**
14 * Returns the area of a closed path.
15 * The computed area uses the same units as the radius.
16 * The radius defaults to the Earth's radius in meters,
17 * in which case the area is in square meters.
18 */
19 function computeArea(path: LatLng[] | MVCArray<LatLng>, radius?: number): number;
20
21 /**
22 * Returns the distance, in meters, between two LatLngs.
23 * You can optionally specify a custom radius.
24 * The radius defaults to the radius of the Earth.
25 */
26 function computeDistanceBetween(from: LatLng, to: LatLng, radius?: number): number;
27
28 /**
29 * Returns the heading from one LatLng to another LatLng.
30 * Headings are expressed in degrees clockwise from North within the range
31 * [-180,180).
32 */
33 function computeHeading(from: LatLng, to: LatLng): number;
34
35 /**
36 * Returns the length of the given path.
37 */
38 function computeLength(path: LatLng[] | MVCArray<LatLng>, radius?: number): number;
39
40 /**
41 * Returns the LatLng resulting from moving a distance from an origin in
42 * the specified heading (expressed in degrees clockwise from north).
43 */
44 function computeOffset(from: LatLng, distance: number, heading: number, radius?: number): LatLng;
45
46 /**
47 * Returns the location of origin when provided with a LatLng destination,
48 * meters travelled and original heading. Headings are expressed in
49 * degrees clockwise from North. This function returns null when no
50 * solution is available.
51 */
52 function computeOffsetOrigin(to: LatLng, distance: number, heading: number, radius?: number): LatLng;
53
54 /**
55 * Returns the signed area of a closed path. The signed area may be used
56 * to determine the orientation of the path. The computed area uses the
57 * same units as the radius. The radius defaults to the Earth's radius in
58 * meters, in which case the area is in square meters.
59 */
60 function computeSignedArea(loop: LatLng[] | MVCArray<LatLng>, radius?: number): number;
61
62 /**
63 * Returns the LatLng which lies the given fraction of the way between the
64 * origin LatLng and the destination LatLng.
65 */
66 function interpolate(from: LatLng, to: LatLng, fraction: number): LatLng;
67 }
68
69 namespace poly {
70 function containsLocation(point: LatLng, polygon: Polygon): boolean;
71
72 function isLocationOnEdge(point: LatLng, poly: Polygon | Polyline, tolerance?: number): boolean;
73 }
74}