npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapmyindia-sdk-nodejs

v1.1.0

Published

MapMyIndia SDK for NodeJs

Downloads

17

Readme

MayMyIndia SDK for NodeJs

N|Solid

This is unofficial SDK and covers basic APIs. As this is open source project, contributions and suggestions are welcome. API's available in this package.

Dependencies !

Ther are just two packages which are used to make this NPM and these are :-

  • node-rest-client - for making actual http calls behind the scene
  • bluebird - for making promises and return data when its available.

Installation

Installation is pretty easy and straight forward, all you have to do is run this command and you are done.

npm i mapmyindia-sdk-nodejs -S

Usage

1. Autosuggest API

Searches for and auto-suggests results as you type an address, a city or point of interest (POI) and returns available information along with its coordinates.

var mapsdk = require('mapmyindia-sdk-nodejs');
//testing auto Suggestions
// Parameters are API_KEY, any valid string (in this example I was trying to get suggestions of Lovely Professional University, Punjab, India. Yes I am alumni of this lovely university :D )
// this function returns promise which can be used to handle success or failure response accrodingly.
 mapsdk.autoSuggest('YOUR-API-KEY','lovely professional').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
});

2. Geocoding API

The Geocoding API returns a bunch of details about a searched place which could be any of the following types - addresses, pois, phone numbers, house numbers etc.

var mapsdk = require('mapmyindia-sdk-nodejs');
//testing geocoding
// Parameters are API_KEY, Address to geocode (It doesn't have to be exact address ;) )
// this function returns promise which can be used to handle success or failure response accrodingly.
 mapsdk.geoCodeGivenAddressString('YOUR-API-KEY','68, okhla phase 3, delhi').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

3. Reverse Geocoding API

This API returns the closest matching address to a provided latitude-longitude point.

var mapsdk = require('mapmyindia-sdk-nodejs');
// testing reverse geocoding
// Parameters are API_KEY, Latitude, Longitude
// this function returns promise which can be used to handle success or failure response accrodingly.
 mapsdk.reverseGeoCodeGivenLatiLongi('YOUR-API-KEY',26.5645,85.9914).then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

4. Route / Driving Directions API

A REST API that calculate driving route between specified locations including via points, with some optional route parameters.

var mapsdk = require('mapmyindia-sdk-nodejs');
//testing routes
// Parameters are API_KEY, Starting point latitude, Starting point longitude, Ending point latitude, Ending point longitude
// this function returns promise which can be used to handle success or failure response accrodingly.
mapsdk.getRoute('YOUR-API-KEY',28.111,77.111,28.22,77.22).then(function(res)
{
    console.log(JSON.stringify(res));
}).catch(function(ex){
    console.log('came in catch');
    console.log(ex);
});

5. Driving Distance Matrix API

A REST API that provides driving distance and time from a given center point to any number of points.

var mapsdk = require('mapmyindia-sdk-nodejs');
//Driving Distance Matrix API
 mapsdk.getDistance('YOUR-API-KEY',28.6976,77.9749,'29,78|30,78|28,79').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

6. Place / eLoc Details API

This API can be used to extract the details of a particular place with the help of its place id.

var mapsdk = require('mapmyindia-sdk-nodejs');
//Place / eLoc Details API

 mapsdk.getPlaceDetail('YOUR-API-KEY','D75CA2').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

7. Nearby API

This API can be used to search nearby POIs either of a category using the unique code assigned to that category or using a generic keyword.

var mapsdk = require('mapmyindia-sdk-nodejs');
//Nearby API
 mapsdk.getNearByPlaces('YOUR-API-KEY',28.546955020526934,77.28168801307678,'food').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

8. Still Map Image API

These map tiles follow the standard Web Mercator tile format - a.k.a Spherical Mercator, and are usually supported natively by any map library that you are using, but read on if you want to know more details. The URL however does not follow standard slippy map tile names. The image is returned according to a WGS-84 position, pixel size and zoom level of the map image. The image can be a retina image and markers can be added to the image to indicate position of any object.

//Still Map Image API
mapsdk.getStillImage('YOUR-API-KEY',28.546955020526934,77.28168801307678,18,'800x480').then(function(res)
 {
     console.log(JSON.stringify(res));
 }).catch(function(ex){
     console.log('came in catch');
     console.log(ex);
 });

Change "YOUR-API-KEY" with your API key. To get your api key you need to signup/register on MapMyIndia