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

geohashes-near

v2.0.1

Published

Helper function to get list of geohashes given a coordinate and inside a radius

Downloads

373

Readme

geohashes-near

Helper function to get all neighbouring geohashes inside a radius, from a given coordinate.

Installation

Using npm: npm i geohashes-near

Using yarn: yarn add geohashes-near

Usage

Fist import the module

In a CommonJS env

const getHashesNear = require('geohashes-near');

Using ES imports

import getHashesNear from 'geohashes-near';

And then run the function

const position = { latitude: 40.455438, longitude: -3.693636 };
const radius = 20; // 20 meters
const units = 'meters';
const precision = 9;
const hashesInRadius = getHashesNear(position, precision, radius, units);

// hashesInRadius is ["ezjq5uwqk","ezjq5uwqm","ezjq5uwqj","ezjq5uwmv","ezjq5uwmu","ezjq5uwmg","ezjq5uwq5","ezjq5uwq7","ezjq5uwqs","ezjq5uwqt","ezjq5uwqh","ezjq5uwqe","ezjq5uwqw","ezjq5uwqq","ezjq5uwqn","ezjq5uwmy","ezjq5uwmw","ezjq5uwmt","ezjq5uwms","ezjq5uwme","ezjq5uwmd","ezjq5uwmf","ezjq5uwq4","ezjq5uwq6","ezjq5uwqd","ezjq5uwqu","ezjq5uwqv","ezjq5uwqg","ezjq5uwqy","ezjq5uwqf","ezjq5uwqx","ezjq5uwqr","ezjq5uwqp","ezjq5uwmz","ezjq5uwmx","ezjq5uwmr","ezjq5uwmq","ezjq5uwmm","ezjq5uwmk","ezjq5uwm7","ezjq5uwm6","ezjq5uwm3","ezjq5uwm9","ezjq5uwmc","ezjq5uwq1","ezjq5uwq3","ezjq5uwq9","ezjq5uwqc","ezjq5uww2","ezjq5uww0","ezjq5uwtb","ezjq5uwt8","ezjq5uwmn","ezjq5uwmj","ezjq5uwmh","ezjq5uwm5","ezjq5uwm4","ezjq5uwm1","ezjq5uwm2","ezjq5uwm8","ezjq5uwmb","ezjq5uwq0","ezjq5uwq2","ezjq5uwq8","ezjq5uww1","ezjq5uwtc","ezjq5uwjx","ezjq5uwjz","ezjq5uwnp","ezjq5uwnr"]

Result

Table of contents

Type aliases

Functions

Type aliases

Coord

Ƭ Coord: object

Type declaration:

| Name | Type | | :---------- | :------- | | latitude | number | | longitude | number |

Defined in: index.ts:15

Functions

default

default(coord: Coord, precision: number, radius: number, units: Units, maskPolygon?: Polygon | MultiPolygon): string[]

Gets geohashes of a certain precision near the given coordinate

Parameters:

| Name | Type | Description | | :------------- | :---------------------- | :----------------------------------------------------------- | | coord | Coord | The central coordinate | | precision | number | The geohash precision | | radius | number | The radius in which to find neighboring geohashes | | units | Units | Units for radius | | maskPolygon? | Polygon | MultiPolygon | Polygon to use as mask to filter geohashes by their centroid |

Returns: string[]

Array of neighbouring geohashes in radius

Defined in: index.ts:75