LatLng.js

  • LatLng()

    LatLng's constructor

  • LatLng.from()

    Converts the two given parameters to a LatLng object

  • toString()

    Converts a LatLng instance to a string.
    Ex.: 'LatLng(43.15,22.17)'

  • clone()

    Returns a copy of the current instance

  • isEqual()

    Checks if the current instance's values is equal to another's

  • round()

    Returns a copy of the current instance with the lat and lng values rounded to nearest integer

  • toArray()

    Returns an array consisting of lat and lng fields of the LatLng object. Default: [lat, lng]

LatLng()


constructor

LatLng class is used to define a geographic point which contains a latitutude and a longitude

Parameter Type Description
lat Number The latitude
lng Number The longitude

LatLng.from()


method
static

Converts the two given parameters to a LatLng object

Parameter Type Description
p1 LatLng | Array | Number The first parameter
p2 Number If p1 is a number, p2 will be used to convert to a LatLng object
returns
LatLng - The converted LatLng object

toString()


method

Converts a LatLng instance to a string.
Ex.: 'LatLng(43.15,22.17)'

returns
String - The converted string

clone()


method

Returns a copy of the current instance

returns
LatLng - The copy of the current instance

isEqual()


method

Checks if the current instance's values is equal to another's

Parameter Type Description
other LatLng The other instance
returns
Boolean - If true, the instances' values are equal

round()


method

Returns a copy of the current instance with the lat and lng values rounded to nearest integer

returns
LatLng - The new rounded instance

toArray()


method

Returns an array consisting of lat and lng fields of the LatLng object. Default: [lat, lng]

Parameter Type Description
inverse Boolean Inverts the returned array - [lng, lat]
returns
Array - The array form of LatLng