1.0.5 • Published 1 year ago

freegeolocate v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

freegeolocate

freegeolocate is a simple Node.js package that allows you to search for a location and retrieve its latitude and longitude without the need for an API key or other configurations. It provides an easy and straightforward way to get geolocation data for any place.

Features

  • No API Key Required: Start using the package immediately without any setup.
  • Easy to Use: Just pass the location name and get the geolocation data.
  • Lightweight: Minimal dependencies and efficient performance.

Installation

To install freegeolocate, use npm:

Install

npm install freegeolocate

Fetch Coordinates and Distance Between

const { fetchCoordinates, getDistanceBetween } = require('freegeolocate');

const getLocationInfo = async () => {
try {
    
    const londonLocation = await fetchCoordinates('london');
    console.log('London Coordinates:', londonLocation);

    const distance = await getDistanceBetween('london', 'pakistan');
    console.log('Distance between London and Pakistan:', distance);

} catch (error) {
    console.error('Error:', error.message);
  }
}

getLocationInfo();

Output

London Coordinates: {
address: 'London, Greater London, England, United Kingdom',
 latitude: 51.5074456,
 longitude: -0.1277653
}

Distance between London and Pakistan: { distance_miles: 3840.223890143061 }

People

The original author of freegeolocate is LinkedIn