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
adminSet of options to display the selected administrative area on the map when it's available.
const adminArea = {
show: true,
fillColor: 'rgba(0, 75, 120, 0.1)',
outlineColor: 'rgba(0, 75, 120, 1)',
}
Optional
boundarySet of options to restrict your forward geocoding to specific regions. It will filter out all locations outside 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 on the right side of the input.
Optional
containerThe custom <div>
that will contain the input and geocoding results when Places JS is used as Leaflet Control.
By default this is generated by Jawg Places JS.
With some frameworks/UI libs such as React, you can't use the ref here.
Optional
debounceSet the number of milliseconds to wait before sending search requests.
If you press Enter
the search will be immediately validated.
This option works 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 through a function. The radius is 50km and cannot be changed.
Replaced by FocusOptions.point
Optional
inputThe <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
inputClass to add to the input when it's generated by the library.
The Leaflet instance for marker creation
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
markerOption for Leaflet markers.
const marker = {
show: 'all',
}
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 works 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 cleared.
Optional
onCallback triggered when the user click on a result.
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.
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',
fillColor: 'rgba(105, 87, 117, 0.1)',
outlineColor: 'rgba(105, 87, 117, 1)',
}
Optional
placeholderPlaceholder text to add when the input in generated by the library.
Optional
positionPosition of the input on the map.
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 on the left side of 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 recommended.
Optional
transitionSet of option to configure the transition when the user click on a result on Leaflet.
const transition = {
type: 'hybrid',
}
Options to configure a Places JS instance for a Leaflet map.
Remarks
Options for JawgPlaces.Leaflet