Fork me on GitHub
Show:

latLonUtil

static

Summary

Methods

arrayToBounds

Syntax

arrayToBounds

(
  • bounds
)
google.maps.LatLngBounds

Summary

Converts an array of SW/NE coordinates to a google LatLngBounds object.

Parameters:

  • bounds Bounds

    LatLons of SW and NE corners.

arrayToLatLng

Syntax

arrayToLatLng

(
  • latLon
)
google.maps.LatLng

Summary

Convert an array of latitude and longitude to Google's Lat/Lng object.

Parameters:

Returns:

boundsToArray

Syntax

boundsToArray

(
  • bounds
)
Bounds

Summary

Parameters:

Returns:

Bounds:

SW and NE Corner LatLons.

decimalToDegrees

Syntax

decimalToDegrees

(
  • decimal
)
Array.<number>

Summary

Converts a decimal coordinate to degrees.

eg. 45.1234567 --> [45, 7, 24.4452]

Parameters:

Returns:

Array.<number>:

as [degrees, seconds, minutes].

degreesToDecimal

Syntax

degreesToDecimal

(
  • degrees
)
Number

Summary

Converts an array of [degrees, minutes, seconds] to a decimal coordinate.

eg. [45, 7, 24.4452] --> 45.1234567

Parameters:

  • degrees Array.<number>

    as [degrees, minutes, seconds].

Returns:

degreesToLatLon

Syntax

degreesToLatLon

(
  • degrees
)
LatLon

Summary

Converts a coordinate from degrees to decimal latLon.

eg. [[45, 7, 24.4452], [-90, 7, 24.4452]] --> [45.1234567, -90.1234567]

Parameters:

  • degrees Array.<Array.<number>>

    Array of North and West coordinates as [degrees, minutes, seconds].

Returns:

LatLon:

LatLon coordinates as decimals.

findCloset

Syntax

findCloset

(
  • target
  • numbers
)

Summary

Find the number closet to a target number.

Parameters:

latLngToArray

Syntax

latLngToArray

(
  • latLng
)
LatLon

Summary

Converts a {google.maps.LatLng} object to a plain array

Parameters:

Returns:

latLngToPath

Syntax

latLngToPath

(
  • latLng
)
Path

Summary

Converts an array of {google.maps.LatLng} objects to a plain path array.

Parameters:

Returns:

Path:

latLonToDegrees

Syntax

latLonToDegrees

(
  • latLon
)
Bounds

Summary

Converts a latLon coordinate to degrees, minutes, and seconds.

eg. [45.1234567, -90.1234567] --> [[45, 7, 24.4452], [-90, 7, 24.4452]]

Parameters:

Returns:

Bounds:

Array of North and West coordinates as [degrees, minutes, seconds].

pathToLatLng

Syntax

pathToLatLng

(
  • path
)
Array.<google.maps.LatLng>

Summary

Converts a path array to an array of {google.maps.LatLng} objects.

Parameters: