encoding namespace
google.maps.geometry.encoding
namespace
Utilities for polyline encoding and decoding.
Requires the &libraries=geometry
URL parameter. See Libraries in the Maps JavaScript API.
Static Methods | |
---|---|
decodePath |
decodePath(encodedPath) Parameters:
Return Value:
Array<LatLng> Decodes an encoded path string into a sequence of LatLngs. |
encodePath |
encodePath(path) Parameters:
Return Value:
string Encodes a sequence of LatLngs into an encoded path string. |
spherical namespace
google.maps.geometry.spherical
namespace
Utility functions for computing geodesic angles, distances and areas. The default radius is Earth's radius of 6378137 meters.
Requires the &libraries=geometry
URL parameter. See Libraries in the Maps JavaScript API.
Static Methods | |
---|---|
computeArea |
computeArea(path[, radius]) Parameters:
Return Value:
number Returns the area of a closed path. The computed area uses the same units as the radius. The radius defaults to the Earth's radius in meters, in which case the area is in square meters. |
computeDistanceBetween |
computeDistanceBetween(from, to[, radius]) Parameters:
Return Value:
number Returns the distance, in meters, between two LatLngs. You can optionally specify a custom radius. The radius defaults to the radius of the Earth. |
computeHeading |
computeHeading(from, to) Parameters:
Return Value:
number Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range [-180,180). |
computeLength |
computeLength(path[, radius]) Parameters:
Return Value:
number Returns the length of the given path. |
computeOffset |
computeOffset(from, distance, heading[, radius]) Parameters:
Return Value:
LatLng Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north). |
computeOffsetOrigin |
computeOffsetOrigin(to, distance, heading[, radius]) Parameters:
Return Value:
LatLng|null Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available. |
computeSignedArea |
computeSignedArea(loop[, radius]) Parameters:
Return Value:
number Returns the signed area of a closed path. The signed area may be used to determine the orientation of the path. The computed area uses the same units as the radius. The radius defaults to the Earth's radius in meters, in which case the area is in square meters. |
interpolate |
interpolate(from, to, fraction) Parameters:
Return Value:
LatLng Returns the LatLng which lies the given fraction of the way between the origin LatLng and the destination LatLng. |
poly namespace
google.maps.geometry.poly
namespace
Utility functions for computations involving polygons and polylines.
Requires the &libraries=geometry
URL parameter. See Libraries in the Maps JavaScript API.
Static Methods | |
---|---|
containsLocation |
containsLocation(point, polygon) Parameters:
Return Value:
boolean Computes whether the given point lies inside the specified polygon. |
isLocationOnEdge |
isLocationOnEdge(point, poly[, tolerance]) Parameters:
Return Value:
boolean Computes whether the given point lies on or near to a polyline, or the edge of a polygon, within a specified tolerance. Returns 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. |