Places JS
Estimated reading time: 1 minuteJawg Places JS was created to facilitate the integration of Jawg Places in websites that have or do not have maps. We have provided a typescript definition as well as a lib API documentation to help developers when integrating the library.
Prerequisite
For all of our examples, you will need:
- an API key and Jawg account (from the lab),
- basic knowledge in JavaScript and HTML
Get the library
There are several ways to get this library:
- from npmjs.com (package name: @jawg/js-loader)
import JawgJSLoader from "@jawg/js-loader";
new JawgJSLoader({ accessToken: "<YOUR_ACCESS_TOKEN>" })
.loadJawgPlaces()
.then(JawgPlaces => {
let jawgPlaces = new JawgPlaces.Input();
});
- from our CDN
<script src="https://api.jawg.io/libraries/jawg-places@latest/jawg-places.js?access-token=<YOUR_ACCESS_TOKEN>"></script>
Attribution
Your input must display "Powered by Jawg".
Examples
- Examples with
<input>
element : Add geocoding to a simple input - Examples with
MapLibre
orMapbox
: Add geocoding to a map, compatible with both MapLibre GL JS and Mapbox GL JS. - Examples with
Leaflet
: Add geocoding to a Leaflet map.