ola-maps
v0.0.6
Published
JavaScript SDK for a seamless interface to interact with the OLA Maps API, simplifying geocoding, reverse geocoding, and routing operations.
Downloads
55
Maintainers
Readme
OLA Maps SDK
This JavaScript SDK provides a seamless interface to interact with the OLA Maps API, simplifying geocoding, reverse geocoding, and routing operations.
Installation
Install the SDK using npm:
npm i --save ola-maps
Or using yarn:
yarn add ola-maps
Modules
The SDK consists of two main modules:
- Places: Provides functionality for autocomplete, geocoding, and reverse geocoding. For more details, check the Places documentation.
- Routing: Enables the calculation of directions between locations. For more details, check the Routing documentation
Authentication
This SDK supports authentication using API_KEY
. Generate your API key by following the instructions in the OLA Maps documentation: https://maps.olakrutrim.com/docs/auth
Basic Example
import { Places, Routing } from "ola-maps";
const placesClient = new Places("YOUR_API_KEY");
const routingClient = new Routing("YOUR_API_KEY");
async function main() {
const autocompleteResult = await placesClient.autocomplete("Koramangala");
console.log(autocompleteResult);
const geocodeResult = await placesClient.geocode("Regent Insignia, 4th Block, 17th Main, Koramangala");
console.log(geocodeResult);
const reverseGeocodeResult = await placesClient.reverse_geocode(12.9716, 77.5946);
console.log(reverseGeocodeResult);
const origin = { lat: 12.9716, lng: 77.5946 }; // Bengaluru
const destination = { lat: 19.0760, lng: 72.8777 }; // Mumbai
const directionResult = await routingClient.direction(origin, destination);
console.log(directionResult);
}
main();
Issues
If you encounter any problems or have feature requests, please file an issue on our GitHub repository - https://github.com/iSanjayAchar/ola-maps-node-sdk/issues/new
Contributors ✨
Licence
This SDK is released under the MIT License.