Class: Location

Location

Location represents a geological location.

new Location(longitude, latitude){Location}

location.js, line 6
Use this to get a location instance.
Name Type Description
longitude Number Longitutde value
latitude Number Latitude value
Throws:
  • new Error("Longitutde should be in the range of -180 to 180");
  • new Error("Latitude should be in the range of -90 to 90");
  • new TypeError("Invalide data type");
Example
var location = Built.Location(60,80);

Methods

staticLocation.getCurrentLocation(){Promise.<Location>}

location.js, line 56
Gets your current location
Example
Location.getCurrentLocation()
.then(function(location){
   console.log(location)
});

kilometersFrom(anotherLocation){Number}

location.js, line 80
Gets the distance between this location to another location in kilometers
Name Type Description
anotherLocation Location Location instance
Example
var point1 = Location(100,90);
var point2 = Location(100,80);
var result = point1.kilometersFrom(point2);

metersFrom(anotherLocation){Number}

location.js, line 98
Gets the distance between this location to another location in meters
Name Type Description
anotherLocation Location Location instance
Example
var point1 = Location(100,90);
var point2 = Location(100,80);
var result = point1.metersFrom(point2);

milesFrom(anotherLocation){Number}

location.js, line 116
Gets the distance between this location to another location in miles
Name Type Description
anotherLocation Location Location instance
Example
var point1 = Location(100,90);
var point2 = Location(100,80);
var result = point1.milesFrom(point2);

setLocation(longitude, latitude){Location}

location.js, line 37
Sets the location with given values
Name Type Description
longitude Number Longitutde value
latitude Number Latitude value
Throws:
  • new Error("Longitutde should be in the range of -180 to 180");
  • new Error("Latitude should be in the range of -90 to 90");
  • new TypeError("Invalide data type");
Example
var location = Built.Location();
location = location.setLocation(60,80);