npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@swiftcomplete/reverse-geocode

v1.1.2

Published

Reverse Geocoding wrapper for the Swiftcomplete Places API

Downloads

4

Readme

@swiftcomplete/reverse-geocode

size npm release license

Description

This package provides reverse geocoding using the Swiftcomplete Reverse Geocoding API.

Using this package, you can convert GPS latitude longitude coordinates into readable addresses and locations.

For more documentation, code samples and installation instructions, head over to the Reverse Geocoding API Documentation.

Installation

npm install @swiftcomplete/reverse-geocode

Authentication

Each request needs to be authenticated with an API key, which you can obtain by creating a Swiftcomplete account.

Making a request

const swiftcompleteReverseGeocoder = require('@swiftcomplete/reverse-geocode');

swiftcompleteReverseGeocoder.setAPIKey('INSERT-KEY-HERE');

(async function () {
    let results = await swiftcompleteReverseGeocoder.reverseGeocode('51.499403,-0.127362', {});

    console.log(results);
}());

Response

[
  {
    "primary":{
      "text":"Westminster Abbey",
    },
    "secondary":{
      "text":"London",
    },
    "type":"address.residential.building.data.emptyroad",
    "geometry":{
      "centre":{
        "lat":51.499462,
        "lon":-0.127448,
        "type":"address"
      }
    },
    "distance":{
      "units":"m",
      "measurement":9,
      "type":"biasTowards",
      "geometry":{
        "centre":{
          "lat":51.499403,
          "lon":-0.127362
        }
      }
    },
    "populatedRecord":{
      "lines":[
        "Westminster Abbey",
        "",
        "London",
        "SW1P 3PA",
        "United Kingdom"
      ],
      "label":"Westminster Abbey\nLondon\nSW1P 3PA\nUnited Kingdom"
    }
  }
]

Response field descriptions

  • primary.text - A simple description of the address, usually the building & street
  • secondary.text - A simple description of the location, usually the city
  • geometry.centre - The coordinates of the address
  • geometry.centre.type - The accuracy of the coordinates, either "address", "street" or "postcode"
  • distance - How far the address is from your coordinates
  • distance.geometry.centre - Your original coordinates
  • populatedRecord.lines - The fully formatted postal address, line by line
  • populatedRecord.label - The fully formatted postal address, in a simple label format

Customising the response

It's possible to pass in an optional options object to customise the response. Each field is optional within the object:

  • distanceUnits - Unit of measurement to display how far away the address is from your coordinate ("metric", "imperial", "m", "km", "ft", "mi", default: "metric")
  • groupByCompass - Enabling groupByCompass returns addresses surrounding your coordinate, rather than just the closest. Useful to return an overview of an area and ignore several addresses that are grouped together (true, false, default: "false")
  • maxResults - Max number of results to return (up to 5, default: 1). Note that you are billed per result, so 4 results = 4 charges.
const swiftcompleteReverseGeocoder = require('@swiftcomplete/reverse-geocode');

swiftcompleteReverseGeocoder.setAPIKey('INSERT-KEY-HERE');

(async function () {
    let results = await swiftcompleteReverseGeocoder.reverseGeocode('45.421497,-75.702096', {
        maxResults: 3,
        distanceUnits: "ft"
    });

    console.log(results);
}());

Data coverage

Swiftcomplete reverse geocoding is currently available in the following countries:

  • Canada
  • Great Britain (England, Scotland and Wales)

We'll be adding the following countries shortly:

  • Denmark
  • France
  • Liechtenstein
  • Luxembourg
  • Norway

We regularly update and expand our data coverage - contact us if there's a country or dataset that isn't listed and we'll let you know where it is on our priority list.