# blurred-location

> A JavaScript library to help manage variable location privacy through a "blurred location" model

Latest version **1.0.0** (published 2019-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install blurred-location
pnpm add blurred-location
yarn add blurred-location
bun add blurred-location
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-04-01 |
| First published | 2019-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 272.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | sagarpreet-chadha |
| Maintainers | jywarren |

## Links

- npm: https://www.npmjs.com/package/blurred-location
- Repository: https://github.com/publiclab/blurred-location
- Homepage: https://github.com/publiclab/blurred-location#readme
- Issues: https://github.com/publiclab/blurred-location/issues
- npm.io page: https://npm.io/package/blurred-location

## Dependencies (3)

- [jquery](https://npm.io/package/jquery.md) ^3.2.1
- [leaflet](https://npm.io/package/leaflet.md) ^1.3.3
- [leaflet-blurred-location](https://npm.io/package/leaflet-blurred-location.md) ^1.2.7

## Recent versions

- 1.0.0 (latest) — 2019-04-01

## README

# blurred-location
A JavaScript library to help manage variable location privacy through a "blurred location" model

This library provides the "blurred location" model for `leaflet-blurred-location` - a Leaflet-based interface for selecting a "blurred" or low-resolution location, to preserve privacy

https://github.com/publiclab/leaflet-blurred-location

The goal of this library is to provide the fundamental methods to implement a blurred location model, as described here: https://github.com/publiclab/leaflet-blurred-location/issues/205


## Definition of "blurred location"

See https://github.com/publiclab/leaflet-blurred-location#how-it-works for an in-depth description of how blurred location works. 


## Features

The following functions are provided. 

### `BL.returnZoomByPrecision(precision)`

This function returns a [Leaflet-style](http://leafletjs.com/) zoom level from `precision` - a number of digits of precision

```js
BL.returnZoomByPrecision('1')
# => 10
```

### `BL.truncateToPrecision(number, digits)`

This basic function truncates the given `number` to a provided number of `digits`, preserving zeroes to the appropriate precision. 

```js
BL.truncateToPrecision(1.2345678 , 2)
# => 1.23
```

### `BL.getMinimumGridWidth(pixels)`

This in-progress function will return the width of a grid square in the following format, for a web map of the given pixel width:

```js
{
  precision: VALUE,
  degrees: VALUE
}
```

This is used to calculate a usefully sized grid for a given map display. 

### `BL.getGridCoordinatesFromLatitude(latitude)`

This function calculates the grid size from the precision of the `latitude` value (the maximum zoom where a marker would be visible). This function depends on the dimension of the map container. 
To calculate distance in pixels between 2 coordinates, one should use the function as decribed in the documentation of map used (for example Leaflet).

### `BL.gridWidthInPixels()` (planned, for integration with Leaflet)



****

## Examples

See these in action in our test suite, here: 

https://github.com/publiclab/blurred-location/blob/main/spec/javascripts/test_spec.js

---
_Source: https://npm.io/package/blurred-location · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
