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

google-map-api-helper

v1.0.3

Published

This library is specially designed to help developer to do some tedious operations on map within a time

Downloads

3

Readme

Google Map Api Helper

Google map is the leading location data and visualisation platform for the web. You might use it to show and view locations on map, draw point, line, polygone and route between two points, track vehicle etc.

This library is specially designed to help developer to do some tedious operations on map within a time.

This library provide solution to efficiently get the distance between two locations, get the exact address from the latitude and longitude, get the address by providing place ID and get shortest path between multiple points on map

Requirement The first step is to acquire the Google Maps API key. Before you can do any of this, you need a Google account – However, I’m going to assume that most of you have a Google account already, so let’s skip to the next step.

When you’re logged into Google, make your way to the Google Maps Javascript API page – link here.

after that enable all need api's you use


Documentation

Installation

npm

npm install google-map-api-helper --save

yarn

yarn add google-map-api-helper

Get distance between two lat long

import { getDistanceLatLog } from 'google-map-api-helper';

getDistanceLatLog({lat:26.549394, log:80.5370636}, {lat:26.6418662,log:80.7651918})
.then(res => console.log(res))
.catch(error => console.log(error))


// async await syntax

const getData = async () => {
  try {
    const res = await getDistanceLatLog(
      { lat: 26.549394, log: 80.5370636 },
      { lat: 26.6418662, log: 80.7651918 }
    );
    console.log(res);
  } catch (error) {
    console.error(error);
  }
};

getData()

Get address by lat long

import { getAddressByLatlng } from 'google-map-api-helper';

getAddressByLatlng(map_api_key,26.549394,80.5370636)
.then(res => console.log(res))
.catch(error => console.log(error))


// async await syntax

const getData = async () => {
  try {
    const res = await getAddressByLatlng(map_api_key,26.549394,80.5370636)
    console.log(res);
  } catch (error) {
    console.error(error);
  }
};

getData()

Get address by placeId

import { getAddressByPlaceId } from 'google-map-api-helper';

getAddressByPlaceId(map_api_key,'ChIJn9QLssk0hTkRGgTUaoU3Igo')
.then(res => console.log(res))
.catch(error => console.log(error))


// async await syntax

const getData = async () => {
  try {
    const res = await getAddressByPlaceId(map_api_key,'ChIJn9QLssk0hTkRGgTUaoU3Igo')
    console.log(res);
  } catch (error) {
    console.error(error);
  }
};

getData()

Get Google map Directions

import { getDirections } from 'google-map-api-helper';


const data = [
  {
    "lat": 28.785065113983514,
    "lng": 77.22917705769757
  },
  {
    "lat": 28.762194273521946,
    "lng": 77.35551983113507
  },
  {
    "lat": 28.717641939370953,
    "lng": 77.35551983113507
  },
  {
    "lat": 28.735705986138594,
    "lng": 77.26488262410382
  }
]
getDirections(map_api_key, data)
.then(res => console.log(res))
.catch(error => console.log(error))


// async await syntax

const getData = async () => {
  try {
    const res = await getDirections(map_api_key, data)
    console.log(res);
  } catch (error) {
    console.error(error);
  }
};

getData()

Import Default

import GMAH from 'google-map-api-helper';

GMAH.getDistanceLatLog({lat:26.549394, log:80.5370636}, {lat:26.6418662,log:80.7651918})
.then(res => console.log(res))
.catch(error => console.log(error))

GMAH.getAddressByLatlng(map_api_key,26.549394,80.5370636)
.then(res => console.log(res))
.catch(error => console.log(error))

GMAH.getAddressByPlaceId(map_api_key,26.549394,80.5370636)
.then(res => console.log(res))
.catch(error => console.log(error))


const data = [
  {
    "lat": 28.785065113983514,
    "lng": 77.22917705769757
  },
  {
    "lat": 28.762194273521946,
    "lng": 77.35551983113507
  },
  {
    "lat": 28.717641939370953,
    "lng": 77.35551983113507
  },
  {
    "lat": 28.735705986138594,
    "lng": 77.26488262410382
  }
]


GMAH.getDirections(map_api_key, data)
.then(res => console.log(res))
.catch(error => console.log(error))