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

ospoint

v0.2.1

Published

Converts Ordnance Survey grid references into Longitgude and Latitude

Downloads

2,717

Readme

CircleCI Coverage Status Minified & Gzipped Size Dependencies

Ordnance Survey Point Converter

Try OsPoint on RunKit

Converts Ordnance Survey grid points (UK National Grid, Northings & Eastings) into latitude and longitude

For anyone who has ever tried to get useful location data from Ordnance Survey's Code-Point Open but was stuck with Northings and Eastings, you can use this package to convert those numbers into longitude and latitude.

OSPoint will allow you to convert Northings and Eastings into OSGB36, ETRS89 or WGS84 coordinates. If you're not sure which one you need, you probably just want WGS84.

This package is based on equations provided by the people at the Ordance Survey.

OSPoint will accurately translate Northings and Eastings for the United Kingdom.

New Now supports conversion of Irish National Grid coordinates. Please take care when transforming Irish coordinates - you will need to pass in the name of the proper mercator projection (as demonstrated below).

Getting Started

const OSPoint = require('ospoint');

// Create a new OSPoint instance, with Northings & Eastings
const point = new OSPoint("NORTHINGS", "EASTINGS");

// Retrieve OSGB coordinates
point.toOSGB36();

// Retrieve ETRS89 coordinates
point.toETRS89();

// Retrieve WGS84 coordinates
point.toWGS84();

If your Northings and Eastings data is a Irish National Grid coordinate, be sure to pass in "irish_national_grid" when converting. OSPoint will then use the appropriate mercator projection. For example:

const OSPoint = require('ospoint');

// Create a new OSPoint instance, with Irish Northings & Eastings
const point = new OSPoint("NORTHINGS", "EASTINGS");

// Retrieve ETRS89 coordinates
point.toETRS89("irish_national_grid");

// Retrieve WGS84 coordinates
point.toWGS84("irish_national_grid");

Nota Bene

  • Northings and Eastings must be a number (no grid letters)
  • To be safe, you should pass in raw Northings and Eastings as strings. They occasionally come with a leading 0s from the OS dataset, which javascript will interpret as a base-8 number
  • All transformation methods return an object with longitude and latitude properties in decimal degrees

Testing

npm test

Note on ETRS89 and WGS84 Coordinate Systems

ETRS89 is a variation of WGS84 that takes into account the slow North Easterly drifting of the Eurasian tectonic plate. The WGS84 and ETRS89 coordinate systems coincided in 1989 (hence the name) and have drifted apart at a rate of ~2.5cm per year due to tectonic movements.

toWGS84() is currently hard-coded to output the same coordinates as toETRS89(). But in reality WGS and ETRS are off by ~50-60cm in 2013.

Which Coordinate System do I want to translate Northings and Eastings into?

95% of the time, people want WGS84

License

MIT