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

@qalincalabs/limosa

v1.6.4

Published

Geolocation based on Photon (Komoot) through Open Street Map

Downloads

9

Readme

Limosa [alpha]

Address geolocation javascript library on top of Open Street Map (OSM) open source public APIs : Photon (Komoot) for searching, Nominatim for decorating.

Important: Since Photon and Nominatim are free to use please be fair and avoid excessive requests.

Define an address (house, street, locality, postal code, region, country). Limosa then query Photon successive layers and compute a best match, get the exact place (if possible) and places above that (such as country, locality).

Strict ! For instance, if a housenumber doesn't exist in OSM, the geocoder will only output the street.

Usage

import * as limosa from "@qalincalabs/limosa";

const photonResult = await limosa.photonLocate({
  house: "14",
  street: "Quai des Saulx",
  locality: "Bouillon",
  postalCode: "6830",
  country: "Belgium"
});

const uuids = limosa.extractOsmUuids(photonResult)
const nominatimResult = await limosa.nominatimLookup(
  { osm_ids: uuids },
  //{ format: "jsonv2", addressdetails: 1, namedetails: 1, extratags: 1 }
);

/*
photonResult is
{
  "match": {
    "countrycode": "BE",
    "state": "Luxembourg",
    "county": "Neufchâteau",
    "city": "Bouillon",
    "district": "Bouillon",
    "postcode": "6830",
    "street": "Quai des Saulx",
    "housenumber": "14"
  },
  "exactFeature": {
    "geometry": {
      "coordinates": [
        5.069359068004883,
        49.7938062
      ],
      "type": "Point"
    },
    "type": "Feature",
    "properties": {
      "osm_id": 422861107,
      "extent": [
        5.069283,
        49.7938544,
        5.0694352,
        49.7937584
      ],
      "country": "België / Belgique / Belgien",
      "city": "Bouillon",
      "countrycode": "BE",
      "postcode": "6830",
      "county": "Neufchâteau",
      "type": "house",
      "osm_type": "W",
      "osm_key": "tourism",
      "housenumber": "14",
      "street": "Quai des Saulx",
      "district": "Bouillon",
      "osm_value": "attraction",
      "name": "Archéoscope Godefroid de Bouillon",
      "state": "Luxembourg"
    }
  },
  "upperFeatures": [
    // ...
  ]
}
*/

TODOs

  • A place (like a shop) without a street number isn't exactly located
  • Plug with https://github.com/openvenues/libpostal (need to find a public API)

Custom geocoder [ON HOLD]

The geocoder started with this but it's now put on the side

Strategies

How to

import { Geocoder, ofnBeProfile, nominatimGetDetails } from "@qalincalabs/limosa";

const geocoder = new Geocoder(ofnBeProfile); // replace ofnBeProfile with your own defined profile

// the input has your address structure
const result = await geocoder.locate({
  address1: "Grand rue 40",
  country_id: 29,
  country_name: "Belgium",
  zipcode: "6850",
  city: "Carlsbourg",
});

/*
result is
{
  electedMatch: {
    countrycode: "BE",
    state: "Luxembourg",
    county: "Neufchâteau",
    city: "Paliseul",
    district: "Carlsbourg",
    postcode: "6850",
    street: "Grand Rue",
    housenumber: "40",
  },
  electedOsmElement: {
    id: "890827177",
    type: "W",
  },
}
*/