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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@quantojs/geo

v0.6.0

Published

Geographic coordinates for quanto: parse "40.7128, -74.0060", degrees, minutes and seconds, plus codes and geohashes into { lat, lng }, and format them back.

Downloads

721

Readme

@quantojs/geo

Geographic coordinates for quanto: 40.7128, -74.0060, 40.7128° N, 74.0060° W, 40°42'46" N 74°0'22" W, lat 40.7128, lng -74.0060 and plus codes like 849VCWC8+R9 parse into { lat, lng } in decimal degrees (WGS 84).

import { coordinates, degreesMinutesSeconds, distance, toPlusCode } from '@quantojs/geo';

coordinates().parse('40.7128, -74.0060');                      // { lat: 40.7128, lng: -74.006 }
coordinates().parse('40°42\'46" N 74°0\'22" W');               // { lat: 40.712778, lng: -74.006111 }
coordinates().parse('40,7128 -74,0060', { locale: 'de-DE' });  // { lat: 40.7128, lng: -74.006 }
coordinates().parse('849VCWC8+R9');                            // { lat: 37.4220625, lng: -122.0840625 }: the code's center
coordinates({ order: 'lngLat' }).parse('[-74.0060, 40.7128]'); // { lat: 40.7128, lng: -74.006 }
coordinates({ geohash: true }).parse('dr5regw3p');             // { lat: 40.712779, lng: -74.005988 }
coordinates().format({ lat: 40.7128, lng: -74.006 });          // '40.7128° N, 74.006° W'
coordinates({ format: degreesMinutesSeconds }).format({ lat: 40.7128, lng: -74.006 });  // '40°42\'46.1" N, 74°0\'21.6" W'
toPlusCode({ lat: 40.7128, lng: -74.006 });                    // '87G7PX7V+4J'
distance({ lat: 40.7128, lng: -74.006 }, { lat: 51.5072, lng: -0.1276 });  // 5570250 (meters)
  • Notations: decimal degrees, hemisphere letters or words before or after each part (N40.7128, 40.7128N, 40.7128 North), labels (lat, lng, lon, long, latitude, longitude), degrees, minutes and seconds, degrees and decimal minutes (40°42.767' N), and full plus codes. With letters or labels, the two parts come in either order. A sign that contradicts its letter (-40 N) is an issue.
  • Order: a bare pair is latitude first, as people write it and map apps copy it. order: 'lngLat' reads GeoJSON's order. A pair out of range in the field's order is an issue, never swapped silently; when the swapped reading is in range, it's offered as an alternative.
  • Separators: a comma, a semicolon or a space. A comma between digits is a decimal comma where the locale writes decimals with one (40,7128; -74,0060 in de-DE) and a separator elsewhere; a point is always a decimal point, so copied 40.7128, -74.0060 reads everywhere.
  • Plus codes read as the center of the code's area. Short codes (Q2PQ+6R New York) need a reference location, so they're an issue: enter the full code.
  • Geohashes are opt-in (geohash: true), since ordinary words can be geohashes (denver). They need at least 5 characters and read as the center of the cell. Text that reads both ways (40n74w) is ambiguous.
  • Formatting prints decimal degrees to 6 places (about 0.1 m) with hemisphere letters, in the field's order. degreesMinutesSeconds, degreesDecimalMinutes, plusCode and geohash are ready-made formatters for the format option.
  • Operations: toPlusCode(coords, codeLength = 10), toGeohash(coords, precision) and distance(a, b), the great-circle distance in meters on a sphere of the Earth's mean radius (6,371,008.8 m).
  • Still evolving. Parse results may change between releases as notations are added (UTM and MGRS are next).

quanto is a peer dependency.