1.0.9 • Published 1 year ago

geolocator-helper v1.0.9

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

Geolocator Helper

The geolocator-helper library provides a simple React hook to access geolocation data and convert coordinates to an address. It integrates with the olakrutrim service for address conversion.

External Service(completely free)

The useGeolocation hook relies on the olakrutrim service for address conversion. To use this service, visit:

Service URL: https://maps.olakrutrim.com/ Make sure you have a valid API key from olakrutrim to utilize the hook effectively.

Installation

To install the geolocator-helper library, use npm or yarn:

npm install geolocator-helper

Usage

Import the useGeolocation hook from the library and use it within your React component to access geolocation data:

import { useGeolocation } from 'geolocator-helper';

const MyComponent = () => {
    const { latitude, longitude, address, error } = useGeolocation('YOUR_API_KEY_HERE');
/*if you donot provide api key it will still give latitude and longitude for adress you will need api key*/
    if (error) {
        return <div>Error: {error}</div>;
    }

    return (
        <div>
            <p>Latitude: {latitude}</p>
            <p>Longitude: {longitude}</p>
            <p>Address: {address}</p>
        </div>
    );
};

Note

The geolocator-helper library is specifically designed for use in React applications and is not suitable for backend environments like Node.js.

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago