Geolocation Service
npm install geolocationservicebash
npm install geolocation-service
`
Usage
$3
`javascript
const { getGeolocation, getAddress } = require('geolocation-service');
`
$3
`javascript
const address = "New York, USA";
getGeolocation(address)
.then(coordinates => {
console.log("Coordinates:", coordinates);
})
.catch(error => {
console.error("Error:", error);
});
`
$3
`javascript
const latitude = 40.7128;
const longitude = -74.0060;
getAddress(latitude, longitude)
.then(address => {
console.log("Address:", address);
})
.catch(error => {
console.error("Error:", error);
});
`
API
$3
Retrieves the geolocation coordinates (latitude and longitude) for a given address.
- address (string): The address for which to retrieve geolocation coordinates.
Returns a Promise that resolves to an object containing the latitude and longitude coordinates.
$3
Retrieves the address for given geolocation coordinates.
- latitude (number): The latitude coordinate.
- longitude` (number): The longitude coordinate.