New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gcoords

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcoords

NPM module to look up a city's coordinates and vice versa

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

GCoords

A tiny NPM module for looking up coordinates from an address. Relies on the Google Maps web API. You will need to get a key here. The only dependency is the native https module for making the request.

Usage

Import it into your project:

const gcoords = require("gcoords");

Initialize with an API key:

gcoords.init(<YOUR_API_KEY>);

Lookup location's coordinates:

gcoords.getCoords("Rome, Italy").then((result) => {
	console.log(result);
});

Lookup coordinates' address:

gcoords.getLocation(["40.714224","-73.961452"]).then((result) => {
	console.log(result);
});

Both functions support a second parameter - the data format. If left blank, the default is json. Some examples:

gcoords.getLocation(["40.714224","-73.961452"],"json").then((result) => {
	//Will return JSON
});

gcoords.getLocation(["40.714224","-73.961452"]).then((result) => {
	//Will also return JSON
});

gcoords.getLocation(["40.714224","-73.961452"],"xml").then((result) => {
	//XML because why not...
});

Roadmap

  • JSON support
  • XML support
  • Coordinates to location
  • Error handling/address cleanup/validation
  • Multiple results
  • Clean up the code
  • Promises
  • Push to NPM

Keywords

google

FAQs

Package last updated on 08 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts