Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dnsos/stimulus-maplibre
A Stimulus controller that registers a MapLibre map with some configurations
https://github.com/dnsos/stimulus-maplibre
map maplibre maplibre-gl-js stimulus stimulus-js
Last synced: 25 days ago
JSON representation
A Stimulus controller that registers a MapLibre map with some configurations
- Host: GitHub
- URL: https://github.com/dnsos/stimulus-maplibre
- Owner: dnsos
- License: mit
- Created: 2022-11-02T18:12:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-19T14:09:50.000Z (about 2 years ago)
- Last Synced: 2024-11-14T20:49:14.569Z (3 months ago)
- Topics: map, maplibre, maplibre-gl-js, stimulus, stimulus-js
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/stimulus-maplibre
- Size: 978 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stimulus MapLibre controller
A Stimulus controller that registers a MapLibre map with some configurations.
> **Attention**: This library is still in early development. Expect breaking changes and incomplete documentation.
## What is this?
Basically, this is a wrapper around [MapLibre GL JS](https://maplibre.org/maplibre-gl-js-docs/api/). It handles some boilerplate that is needed for most maps. The idea is to use this as a base and write controllers that extend this one to add more features to the map.
You can currently:
- define a map center
- define a zoom level
- define a min and max zoom level
- define if the map should be interactive
- use your own style URL or style specification![Stimulus MapLibre hero image](/images/stimulus-maplibre-hero.png)
## Todo's
- [x] Remove default OSM style and require active provision of style URL? (see the [OSM policy](https://operations.osmfoundation.org/policies/tiles/))
- [x] general housekeeping
- [x] figure out NPM publishing
- [ ] enhance docs
- [x] setup GitHub Action for CI
- [ ] improve error messages (more specific)
- [ ] Validate lat/lng so they only allow realistic values (-90 - 90 and -180 - 180)
- [x] consider removing marker functionaloty as it may be too specific (this should really only handle the basics)## Developing
Install dependencies:
```bash
npm install
```Start a development server:
```bash
npm run dev
```Run the tests:
```bash
npm run test
```## Usage
### Prerequisites
- The Maplibre CSS has to be present in your own HTML
- Peer dependencies? Which?
- Node v16 or higher