Optional
accessYour personal access token, create your own on the Jawg Lab. This is filled automatically when you get the library with our CDN or @jawg/js-loader.
Optional
boundarySet of options to restrict your forward geocoding to specific regions. It will filter out all locations outside of the configured boundaries.
const boundary = {
countries: 'fra',
circle: { lat: 46.842269, lon: 2.39985, radius: 500 },
rectangle: {
min: { lat: 43.032582, lon: 5.097656 },
max: { lat: 49.006466, lon: 26.762695 },
},
gids: ['openstreetmap:island:relation/966358']
}
Optional
clearAdd a clear cross in the right side of the input.
Optional
debounceSet the number of milliseconds to wait before a search validation.
If you press Enter
the search will be immediately validated.
This option work only when searchOnTyping=true
.
Optional
focusSet of options to prioritize your forward geocoding to specific regions. All locations in these regions will have a better ranking.
const focus = {
countries: 'fra',
point: { lat: 46.842269, lon: 2.39985 },
gids: ['openstreetmap:island:relation/966358']
}
Optional
focusSort results in part by their proximity to the given coordinate. Coordinates can be static or dynamic with the function.
Replaced by FocusOptions.point
The <input>
to transform into a geocoding search bar.
This can be either an id (e.g #my-input
), class selector (e.g .my-input
) or the HTMLElement.
With some frameworks/UI libs such as React, you can't use the ref here.
Optional
languageReturn results in a specific language using BCP47 standard (e.g 'en', 'fr', 'de', ...). By default, we use HTTP Header set by the browser and English when not present.
Optional
layersRestrict your search (forward and reverse) to specific layers. You can get only addresses or administrative areas for example.
Optional
minSet the minimum number of characters to trigger a geocoding request.
If you press Enter
the search will be validated even if the length is not reached.
This option work only when searchOnTyping=true
.
Optional
noSet a custom message when no results are found. This can be disabled.
Optional
onCallback triggered when the input is empty.
Optional
onCallback triggered when the user click on a result.
The feature selected by the user
Optional
onCallback triggered when the result list is closed/cleared.
Optional
onCallback triggered when Jawg Places API returns an error.
Optional
onCallback triggered when Jawg Places API returns without error.
The list of features returned by Jawg Places API
Optional
placeOption to activate Place Details detection within the input.
You can paste one or many GIDs in the input.
The separation can be either ,
(comma) or
(space).
const place = {
enabled: true,
geometries: 'source'
}
Optional
resultThe custom <div>
that will contain the geocoding results.
By default the container is created by Jawg Places JS.
With some frameworks/UI libs such as React, you can't use the ref here.
Optional
reverseOption to activate Reverse Geocoding detection within the input.
You can paste coordinates in the form {lat}/{lon} in the input.
The separation can be either /
(slash), ,
(comma) or
(space).
const reverse = {
enabled: true,
radius: 5,
}
Optional
searchSet this to true
to activate search on typing, this will also use autocomplete
search.
Default value is false
, you will need to press Enter
to validate your search.
Optional
showShow icon at the left each results.
Optional
sizeSet the maximum number of results for forward and reverse geocoding.
Optional
sourcesRestrict your search (forward and reverse) to specific data sources. You can get only OSM or WOF data for example. This is not recommanded.
Options to configure a Places JS instance.
Remarks
Options for JawgPlaces.Input