Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ola-maps

isanjayachar136MIT0.0.6TypeScript support: included

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

ola, ola maps, ola maps api, ola maps sdk, ola sdk, maps, online maps, openstreetmap, open street maps, openstreetmaps API, indian map, node, ola maps node, ola maps npm

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.

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.