Open BlackBrix opened 1 week ago
Use the htmlTemplate
option of Nominatim:
L.Control.geocoder({
geocoder: L.Control.Geocoder.nominatim({
htmlTemplate: result => {
return `${result.display_name} ${result.osm_type} ${result.osm_id}`;
}
}),
})
thanks that works, (e.g. you can use result.display_name.split(", ") to access individual elements then)
how to fill the result marker/popup with other JSON variables (strings) from OSM/Nominatim result ?
from the OSM/Nominatim JSON results (examples: https://nominatim.openstreetmap.org/search?format=json&q=%27Wechold%20162%27 https://nominatim.openstreetmap.org/search?format=json&q=%27Lange%20Strasse%204,%2027318%20Hoya%27 ) I would like to extract the 'display_name' or better: individual elements (comma separated) of the 'display_name' to display them in the result marker/popup
I see that I first have to disable the default behaviour with 'defaultMarkGeocode: false' , right ?
but due to my very limited scripting knowledge I don't know how to make a new popup with my own strings/variables (extracted from the OSM/Nominatim JSON results)
or can I go beyond the JSON results and can directly use the "adress tags" as listed here ? https://nominatim.openstreetmap.org/ui/details.html?osmtype=W&osmid=369929468&class=building https://nominatim.openstreetmap.org/ui/details.html?osmtype=W&osmid=225021671&class=building