Socket
Socket
Sign inDemoInstall

what3words

Package Overview
Dependencies
50
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    what3words

Node client for what3words API


Version published
Weekly downloads
5
decreased by-85.29%
Maintainers
1
Install size
3.91 MB
Created
Weekly downloads
 

Readme

Source

#what3words what3words

Node.js library for what3words API

###Getting started

$ npm install --save what3words

###Usage ###Node.js

var w3w = require('what3words');

####Config

var options = {
  key : '<YOUR_API_KEY_HERE>',
  lang : 'en',
  display : 'terse'
}

w3w.config(options);

######options All config options can be overidden in function calls. Each config option will be included in every call that is not overidden by the specific function call.

  • key (required) - your API key (get yours here)
  • lang (optional) - a supported w3w address language: en (the default), de, ru, sv, pt, sw, it, fr, es or tr.
  • format (optional) - return data format type. Can be json (the default), geojson or xml
  • display (optional) - return display type. Can be full (the default) or terse

####Functions For each of the functions below, all options are passed in the first function parameter. If a second parameter is included, that will be the functions callback. If not, the function will return a Promise.

#####forward(options[, callback]) ######options

  • addr (required) - a 3 word address as a string
  • lang (optional) - a supported w3w address language (see Config)
  • format (optional) - return data format type (see Config)
  • display (optional) - return display type (see Config)

#####reverse(options[, callback]) ######options

  • coords (required) - coordinates as a comma separated string of latitude and longitude
  • lang (optional) - a supported w3w address language (see Config)
  • format (optional) - return data format type (see Config)
  • display (optional) - return display type (see Config)

#####autosuggest(options[, callback]) ######options

  • addr (required) - a 3 word address as a string
  • lang (optional) - a supported w3w address language (see Config)
  • format (optional) - return data format type (see Config)
  • display (optional) - return display type (see Config)
  • focus (optional) - a location, specified as a latitude,longitude used to refine the results.
  • clip (optional) - Restricts results to those within a geographical area. If omitted defaults to clip=none.

#####standardblend(options[, callback]) ######options

  • addr (required) - a 3 word address as a string
  • lang (optional) - a supported w3w address language (see Config)
  • format (optional) - return data format type (see Config)
  • focus (optional) - a location, specified as a latitude,longitude used to refine the results.

#####grid(options[, callback]) ######options

  • bbox (required) - Bounding box, specified by the northeast and southwest corner coordinates, for which the grid should be returned
  • format (optional) - return data format type (see Config)

#####languages(options[, callback]) ######options

  • format (optional) - return data format type (see Config)

####Example

var w3w = require('what3words');

w3w.config({
  key : '<INSERT_YOUR_API_KEY>',
  lang : 'en'
});

w3w.forward({
  addr : 'steep.sober.potato',
  display : 'terse'
}, function (err, res){
  if (err) console.log(err);
  else console.log(JSON.stringify(res, null, 4));
});

####Test

$ npm test

Keywords

FAQs

Last updated on 12 Jul 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc