encoding namespace
google.maps.geometry
. encoding
namespace
library "geometry"
Utilities for polyline encoding and decoding.
const { encoding } = await google . maps . importLibrary ( "geometry" );
Static Methods
encodePath(path)
-
path:Array < LatLng | LatLngLiteral >| MVCArray < LatLng | LatLngLiteral >
string
spherical namespace
google.maps.geometry
. spherical
namespace
library "geometry"
Utility functions for computing geodesic angles, distances and areas. The default radius is Earth's radius of 6378137 meters.
const { spherical } = await google . maps . importLibrary ( "geometry" );
Static Methods
computeArea(path[, radiusOfSphere])
-
path:Array < LatLng | LatLngLiteral >| MVCArray < LatLng | LatLngLiteral >| Circle | CircleLiteral | LatLngBounds | LatLngBoundsLiteral -
radiusOfSphere:number optional
number
radiusOfSphere
defaults to the Earth's radius in meters, in which case the area is in square meters. Passing a Circle
requires the radius
to be set to a non-negative value. Additionally, the Circle must not cover more than 100% of the sphere. And when passing a LatLngBounds
, the southern LatLng cannot be more north than the northern LatLng.computeDistanceBetween(from, to[, radius])
-
from:LatLng | LatLngLiteral -
to:LatLng | LatLngLiteral -
radius:number optional
number
computeHeading(from, to)
-
from:LatLng | LatLngLiteral -
to:LatLng | LatLngLiteral
number
computeLength(path[, radius])
-
path:Array < LatLng | LatLngLiteral >| MVCArray < LatLng | LatLngLiteral > -
radius:number optional
number
computeOffset(from, distance, heading[, radius])
-
from:LatLng | LatLngLiteral -
distance:number -
heading:number -
radius:number optional
LatLng
computeOffsetOrigin(to, distance, heading[, radius])
-
to:LatLng | LatLngLiteral -
distance:number -
heading:number -
radius:number optional
LatLng
|null
null
when no solution is available.computeSignedArea(loop[, radius])
-
loop:Array < LatLng | LatLngLiteral >| MVCArray < LatLng | LatLngLiteral > -
radius:number optional
number
The area is computed using the parallel transport method; the parallel transport around a closed path on the unit sphere twists by an angle that is equal to the area enclosed by the path. This is simpler and more accurate and robust than triangulation using Girard, l'Huilier, or Eriksson on each triangle. In particular, since it doesn't triangulate, it suffers no instability except in the unavoidable case when an edge (not a diagonal) of the polygon spans 180 degrees.
interpolate(from, to, fraction)
-
from:LatLng | LatLngLiteral -
to:LatLng | LatLngLiteral -
fraction:number
LatLng
traversePath(path, fraction)
-
path:Array < LatLng | LatLngLiteral | LatLngAltitude | LatLngAltitudeLiteral > -
fraction:number
LatLngLiteral
poly namespace
google.maps.geometry
. poly
namespace
library "geometry"
Utility functions for computations involving polygons and polylines.
const { poly } = await google . maps . importLibrary ( "geometry" );
Static Methods
containsLocation(point, polygon)
-
point:LatLng | LatLngLiteral -
polygon:Polygon
boolean
isLocationOnEdge(point, poly[, tolerance])
-
point:LatLng | LatLngLiteral -
poly:Polygon | Polyline -
tolerance:number optional
boolean
true
when the difference between the latitude and longitude of the supplied point, and the closest point on the edge, is less than the tolerance. The tolerance defaults to 10 -9
degrees.
