Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maplibre/maplibre-gl-geocoder
Geocoding for MapLibre
https://github.com/maplibre/maplibre-gl-geocoder
Last synced: 4 days ago
JSON representation
Geocoding for MapLibre
- Host: GitHub
- URL: https://github.com/maplibre/maplibre-gl-geocoder
- Owner: maplibre
- License: isc
- Created: 2021-07-28T18:15:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T07:46:07.000Z (11 months ago)
- Last Synced: 2024-04-14T05:45:28.449Z (9 months ago)
- Language: JavaScript
- Size: 4.57 MB
- Stars: 43
- Watchers: 6
- Forks: 16
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-maplibre - maplibre-gl-geocoder - Adds a geocoder control. (Geocoding & Search Plugins / JavaScript)
README
## MapLibre GL Geocoder
A geocoder control for [maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js).
### Usage
A full working example can be found here, which uses Nominatim:
https://maplibre.org/maplibre-gl-js/docs/examples/geocoder/### Usage with a module bundler
```bash
npm install --save @maplibre/maplibre-gl-geocoder
``````js
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';
import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css';
...
// Functions should return Carmen GeoJSON, see the relevant type in this project
// View config definitions in our [documentation](https://www.maplibre.org/maplibre-gl-geocoder/)
var Geo = {
// required
forwardGeocode: async (config) => { /* definition here */ },
// optional
reverseGeocode: async (config) => { /* definition here */ }, // reverse geocoding API
getSuggestions: async (config) => { /* definition here */ }, // suggestion API
searchByPlaceId: async (config) => { /* definition here */ } // search by Place ID API
};// Pass in or define a geocoding API that matches the above
const geocoder = new MaplibreGeocoder(Geo, { maplibregl: maplibregl });
map.addControl(geocoder);```
### Using without a Map
It is possible to use the plugin without it being placed as a control on a maplibre-gl map.
### Deeper dive
#### API Documentation
See [here](https://www.maplibre.org/maplibre-gl-geocoder/) for complete reference.
Also check out the example in MapLibre docs:
https://maplibre.org/maplibre-gl-js/docs/examples/geocoder/### Contributing
See [CONTRIBUTING.md](https://github.com/maplibre/maplibre-gl-geocoder/blob/main/CONTRIBUTING.md).
### Licence
ISC © [MapLibre](https://github.com/maplibre) © [Mapbox](https://github.com/mapbox)