Skip to content

JavaScript SDK for a seamless interface to interact with the OLA Maps API, simplifying geocoding, reverse geocoding, and routing operations.

License

Notifications You must be signed in to change notification settings

iSanjayAchar/ola-maps-node-sdk

Repository files navigation

OLA Maps SDK

This JavaScript SDK provides a seamless interface to interact with the OLA Maps API, simplifying geocoding, reverse geocoding, and routing operations.

Codacy Badge Codacy Badge TypeScript NPM Version Licence

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:

  1. Places: Provides functionality for autocomplete, geocoding, and reverse geocoding. For more details, check the Places documentation.
  2. 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 ✨

Kent C. Dodds
Sanjay Achar
Kent C. Dodds
Jeevan V

Licence

This SDK is released under the MIT License.

About

JavaScript SDK for a seamless interface to interact with the OLA Maps API, simplifying geocoding, reverse geocoding, and routing operations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published