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

pickpoint-geocoder

v0.9.3

Published

PickPoint Geocoder Client

Downloads

2

Readme

PickPoint Geocoder for NodeJS

Node library for converting geographical coordinates to addresses and vice versa using OpenStreetMap data.

Requirements

Before using the library you need to obtain API key at https://pickpoint.io. PickPoint is geocoding service. For non-commercial usage it provides Free plan with 2500 requests/day. For details please read the Terms of Service.

Installation

npm install pickpoint-geocoder

Usage

Import the library and initialize geocoder instance.

const Geocoder = require('pickpoint-geocoder');
//...
// Here you need to replace 'YOUR-API-KEY' 
// with a key obtained at https://pickpoint.io.
const geocoder = new Geocoder('YOUR-API-KEY');

Forward Geocoding

Forward geocoding is a translation of geographical names (addresses) to coordinates, i.e.: "New York Liberty Island" ---> "40.68981905, -74.0451396392316".

//...
geocoder.forward('New York Liberty Island').then(res => {
  console.log(res[0]);
});

Reverse Geocoding

Reverse geocoding is a translation of coordinates to geographical names (addresses), i.e.: latitude: 48.8588100, longitude: 2.32003101155031 ---> "Académie de Paris, Rue Casimir Périer, Invalides, 7e, Paris, Île-de-France, France métropolitaine, 75007, France"

//...
geocoder.reverse('48.8588100', '2.32003101155031').then(res => {
  console.log(res);
});

Lookup OSM Object

In case when you just need to refresh information of an object which has been already forward- or reverse- geocoded, you can just reload the data using Lookup function. It's a bit faster operation than address/coordinates transformation.

Today:

//...
geocoder.reverse('48.8588100', '2.32003101155031').then(res => {
  console.log(res);
});

---> osm_type: "relation", osm_id: "5962792", "some data"

20 days later:

//...
geocoder.lookup(['R5962792']).then(res => {
  console.log(res);
});

--> "some updated data"

Batch Processing

As the Geocoder uses promises you're easily able to make asynchronous requests to the servers.

//...
const coordinates = [
   ["51.14075236","14.51772506"],
   ["51.57192303","13.81030787"],
   ["51.5048526","14.85497735"]
];

const promises = coordinates
  .map(c => geocoder.reverse(c[0], c[1], {zoom: 6}));

// For better results please restrict your "parallelism" up to 50-100 simultaneous calls. 
Promise.all(promises).then(results => {
  results.forEach(r => console.log(r.display_name));
});

Examples

You can find a couple of examples of how to use the library in /examples directory. The examples are configured to use relative path to the library. There is a testing API key. Please replace it with your own, because the existing one most probably will be locked by others.

Contributing

Basically the package is pretty simple and we're not expecting further improvements. But it would be great if you could extend the list of examples by snippets from your experience!

  1. Fork it (https://github.com/pickpoint/node-geocoder/fork).
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.

License

MIT