# lightning-maps

> Lightweight, dependency-free slippy map renderer

Latest version **0.0.38** (published 2020-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install lightning-maps
pnpm add lightning-maps
yarn add lightning-maps
bun add lightning-maps
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.38 |
| Published | 2020-03-06 |
| First published | 2018-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Mathias Hansen |
| Maintainers | thecodemonkey |
| Keywords | slippy-map, maps, mapping, osm, openstreetmap |

## Links

- npm: https://www.npmjs.com/package/lightning-maps
- Repository: https://github.com/geocodio/lightning-maps
- Issues: https://github.com/geocodio/lightning-maps/issues
- npm.io page: https://npm.io/package/lightning-maps

## Dependencies (2)

- [topojson-client](https://npm.io/package/topojson-client.md) ^3.0.0
- [robust-point-in-polygon](https://npm.io/package/robust-point-in-polygon.md) ^1.0.3

## Recent versions

- 0.0.38 (latest) — 2020-03-06
- 0.0.37 — 2019-09-27
- 0.0.36 — 2019-09-27
- 0.0.35 — 2019-06-21
- 0.0.34 — 2019-06-18
- 0.0.33 — 2019-06-18
- 0.0.32 — 2019-06-04
- 0.0.31 — 2019-05-31
- 0.0.30 — 2019-05-31
- 0.0.29 — 2019-05-31
- 0.0.28 — 2019-03-11
- 0.0.27 — 2019-03-09
- 0.0.26 — 2019-03-09
- 0.0.25 — 2019-03-09
- 0.0.24 — 2019-03-09
- … 20 more at https://npm.io/package/lightning-maps/versions

## README

# Lightning Maps (*Alpha release*)

A fast, lightweight slippy map renderer with very minimal dependencies.

Heavily inspired by [Pigeon Maps](https://github.com/mariusandra/pigeon-maps) and [Leaflet](https://leafletjs.com), but with slightly different goals in mind:

## Goals

* Modern, built using ES6+ syntax
* Lightweight, minimal dependencies
* Ability to render thousands of markers, by using `<canvas>` rendering instead of depending on the DOM
* Supports rendering of complex polygons
* Wrapper for React (VueJS coming soon)

## Using

### 1. Install

```
yarn add lightning-maps
```

Or link directly to our build via the [unpkg](https://unpkg.com) CDN:

```html
<script src="https://unpkg.com/lightning-maps/lib/LightningMaps.min.js"></script>
```

### 2. Create a `<canvas>` element

```html
<canvas id="map" width="800" height="600"></canvas>
```

### 3. Instantiate the map and add a marker

```javascript
var map = new LightningMaps.Map(canvas, {
  source: function (x, y, z) {
    return `https://maps.geocod.io/tiles/base/${z}/${x}/${y}.png`;
  },
  zoom: 12,
  center: [38.86530697026126, -77.20057854052735]
});

map.addMarker(new LightningMaps.Marker([38.882666, -77.170150]))
```

### 4. Success! You now have a map

![Example](docs/screenshots/markers.png)

## Development

### Run local development build and tests

```bash
yarn run dev
yarn run test:watch
```

### Development urls:
* [http://localhost:9000/simple.html](http://localhost:9000/simple.html)
* [http://localhost:9000/markers.html](http://localhost:9000/markers.html)
* [http://localhost:9000/polygons.html](http://localhost:9000/polygons.html)
* [http://localhost:9000/events.html](http://localhost:9000/events.html)
* [http://localhost:9000/performance.html](http://localhost:9000/performance.html)

### Build library for distribution

```bash
yarn run build
```

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