The following tutorial will demonstrate how to search for points of interest using the UNL SDK.
Create a new method in
unlApi.js which uses the SDK's function to search for POIs.
The next stept is to add a new button in the menu action sheet component (
ActionSheet.js) inside the
<div> element, followed by an input and a list for search results.
Add styles for the search result list and its elements in
Create a new method which fetches search results and allows to generate a route towards them if clicked on. Firstly, append them to the search result list, then add an event listener to each element in the list, such that when a click event happens, a route to its location is generated.
Finally, show the search input in
index.js when the
Search for POIs button is clicked and call the previous method (
searchPois) when a new character gets typed in the input field.
Now you should be able to search for POIs.
The complete code for this sample project can be found on our GitHub page.