New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

city-grabber

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

city-grabber

Grabs the nearest City from gps coordinates.

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by25%
Maintainers
1
Weekly downloads
 
Created
Source

City Grabber

This is a wrapper for the City Grabber API used to find the nearest city and country from latitude and longitude.

City grabber uses an algorithim that utalises spatial mapping and data analysis to give you a blazing fast and accurate response from over 10,000 cities across the glove.

This API requires an API key which can get obtained Here. It will come with 10 free requests.

Installation

npm i city-grabber --save

Usage

const cityGrabber = require( 'city-grabber' )

//Using Promises
cityGrabber.get( latitude, longitude, apiKey )
    .then( response => console.log( response.city, response.country ))
    .catch( e => console.log( e ))
    
//Async await
const response = await cityGrabber.get( latitude, longitude, apiKey )
console.log( response.city, response.country )

Demos

cityGrabber.get( 40.6721694, -73.9593683, apiKey )

//Response
{
    city: 'Brookyln'.
    country: 'US'
}
cityGrabber.get( 35.4526317, 139.4546863, apiKey )

//Response
{
    city: 'Yokohama'.
    country: 'JP'
}

Errors

StatusErrorDescription
422API KEY NOT FOUNDYou need to pass your API key as a parameter. You can get one Here.
422INVALID API KEYYour key is invalid or badly formatted.
402NO CREDITS REMAININGYou need to purchase more credits for your key. You can do that Here.
422INVALID COORDINATESMissing or invalid latitude/ longitude.

Documentation

Click Here to see the full documentation

Keywords

FAQs

Package last updated on 31 Jan 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc