Hey there! Want to build awesome, scalable services like this one?
Read the stdlib documentation on GitHub or Sign up, it's easy to get started and free to use!
Tag 7
thisdavej/gps
  Published by thisdavej on Monday, November 21st, 2016, 3:05:19 PM
  GPS Service - Functions to return results based on GPS coordinates
# GPS Service This service provides functions to return results based on GPS coordinates. There is currently one function available: ## findcity - Find the name of city in the USA based on GPS coordinates ### Parameters #### Keyword arguments - lat: latitude (the angular distance of a place north or south of the earth's equator) - lon: longitude (the angular distance of a place east or west of the meridian at Greenwich, England) - fmt: format of the data to return. If fmt = `simple`, just the city, state, and zip code are returned rather than a full JSON object. ### Usage #### Command line Return a JSON object with city information based on latitude and longitude ```bash $ f thisdavej/gps/findcity --lat 32.72 --lon -117.16 ``` This returns the following JSON object: ```JSON { "zipcode": "92101", "state_abbr": "CA", "latitude": "32.719601", "longitude": "-117.16246", "city": "San Diego", "state": "California", "distance": 0.2343729936809432 } ``` Return a more concise string representing the city: ```bash $ f thisdavej/gps/findcity --lat 32.72 --lon -117.16 --fmt simple ``` This returns the following simple string: ```JSON "San Diego, CA 92101" ``` #### HTTP GET Return a JSON object with city information based on latitude and longitude ```http https://f.stdlib.com/thisdavej/gps/findcity?lat=32.72&lon=-117.16 ``` #### Web and Node.js ```js const f = require('f'); f('thisdavej/gps/findcity')({lat: 32.72, lon: -117.16}, (err, response) => { // handle error or response }); ``` ### Bugs/limitations This function is currenly only capable of finding cities in the USA. ## Author [Dave Johnson](http://thisdavej.com/) ([@thisDaveJ](https://twitter.com/thisDaveJ))
This service has 1 function
  findcity default function
  Find city based on GPS Coordinates
   Arguments
No Arguments Expected
   Keyword Arguments
fmt Format of the data to return. If fmt='simple', just the city, state, and zip code are returned.
lat Latitude
lon Longitude
Command Line Usage
Star stdlib/lib on GitHub
$ npm install lib -g $ f thisdavej/gps
Web and Node.js Usage
Star stdlib/f on GitHub
$ npm install f --save
const f = require('f'); f('thisdavej/gps')(arg0, arg1, {kwarg: val}, (err, response) => { // handle error or response });