Autocomplete with openStreetMap #942
Replies: 2 comments 1 reply
-
Hi Adonis, Please let us know how it goes. Best, |
Beta Was this translation helpful? Give feedback.
-
You probably want to look at Photon, which is an autocomplete-friendly geocoder based on OSM data. You can set up your own instance, or use the public one at photon.komoot.io. You can then use it as a source with a export async function SearchPhoton(str) {
let url = "https://address.of.photon.instance/api?limit=5&lang=en&osm_tag=place&osm_tag=highway&q=" + encodeURIComponent(str);
let response = await fetch(url, { mode: 'cors' });
let json = await response.json();
let items = json.features.map(feature => {
return { type: "Place", name: feature.properties.name, value: feature.properties.name, location: feature.geometry.coordinates, properties: feature.properties };
});
return items;
} You can configure what types of data are returned by Photon in its query string. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Any example for openstreetmap as source for Algolia Autocomplete ? (to replace Algolia place with autocomplete)
Thx !
Beta Was this translation helpful? Give feedback.
All reactions