@maplibre/maplibre-gl-geocoder

1.5.0 • Public • Published

Maplibre GL Geocoder

A geocoder control for maplibre-gl-js.

Usage

Usage with a module bundler

npm install --save @maplibre/maplibre-gl-geocoder
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';
import '@maplibre/maplibre-gl-geocoder/dist/maplibre-gl-geocoder.css';
...
// Functions should return Carmen GeoJSON https://github.com/mapbox/carmen/blob/master/carmen-geojson.md
// View config definitions in our [documentation](https://github.com/maplibre/maplibre-gl-geocoder/blob/master/API.md#setgeocoderapi)
var Geo = {
  forwardGeocode: async (config) => { /* definition here */ },
  reverseGeocode: async (config) => { /* definition here */ }, // optional reverse geocoding API
  getSuggestions: async (config) => { /* definition here */ } // optional suggestion API
};

// Pass in or define a geocoding API that matches the above
const geocoder = new MaplibreGeocoder(Geo, { mapboxgl: maplibregl });

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 API.md for complete reference.

Contributing

See CONTRIBUTING.md.

Licence

ISC © MapLibre © Mapbox

Readme

Keywords

Package Sidebar

Install

npm i @maplibre/maplibre-gl-geocoder

Weekly Downloads

37,782

Version

1.5.0

License

ISC

Unpacked Size

111 kB

Total Files

9

Last publish

Collaborators

  • maplibreorg
  • nyurik
  • klokan