Create a feature from query activity and zoom to the feature on the map
I am trying to set up a following workflow:
User starts with the autocomplete box, and types in a name of the place. After three characters are entered the matching candidates are returned. The next step is: once the user picks on desired matching record, the map would zoom to that record and highlight the record on the map. And that part sort of works, but the feature/graphic is always added for the first matched record and not the record that user selects from the autocomplete list. How do I accomplish that? I tried adding 'For Each' but that didn't work as expected either, it created feature/graphic for the first record (times a number of matched records in autocomplete - please see attached image).
What am i doing wrong?
Thank you.
-
I would put the following activities in the change event of your autocomplete element :- Query the layer to retrieve the desired feature (where =`Attribute = '${$form.state.autocomplete.value}'`)
- Get symbol from JSON
- Create a feature with the query.feature.geometry as geometry parameter and new created symbol
- Add Graphics with the newly created feature
- Set Map Extent with desired scale and the newly created feature
0 -
@Guillaume Ruelle? thank you for your help. That worked.
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
2 kommentarer