Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including google-geolocation with all npm packages installed. Try it out:

var googleGeolocation = require("google-geolocation")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

google-geolocation v1.0.2

Google Maps Geolocation API for Node.js (unofficial)

google-geolocation

Google Maps Geolocation API for Node.js (unofficial)

You need a Google API key with access to the Google Maps Geolocation API.

npm Build Status Coverage Status bitHound Dependencies bitHound Code Greenkeeper badge

Example

const geolocation = require ('google-geolocation') ({
  key: 'api key'
});

// Configure API parameters
const params = {
  wifiAccessPoints: [
    {
      macAddress: '01:23:45:67:89:AB',
      signalStrength: -65,
      signalToNoiseRatio: 40
    }
  ]
};

// Get data
geolocation (params, (err, data) => {
  if (err) {
    console.log (err);
    return;
  }

  console.log (data);
});

Installation

npm i google-geolocation --save

Configuration

paramtyperequireddefaultdescription
keystringyesGoogle API key
timeoutnumberno5000Request timeout in ms

Example

const geolocation = require ('google-geolocation') ({
  key: 'abc123',
  timeout: 2000
});

Errors

messagedescriptionprops
api errorAPI returned an error.error (array), .statusCode
invalid responseAPI returns invalid data.error (string), .statusCode
request failedRequest failed.error

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org

Author

Franklin van de Meent

Buy me a coffee

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free