Issue with Geocoder events.

54 views
Skip to first unread message

san

unread,
Sep 6, 2019, 2:31:58 AM9/6/19
to cesium-dev
Unable to fire an event when a suggestion is selected in geocoder suggestions.But when i'm hitting enter its firing.
How to achieve when suggestion is selected.And also how get the result of geocoder.
I have attached a SandcastleLink for the example.
Please provide me any suggestions.

Omar Shehata

unread,
Oct 3, 2019, 2:43:11 PM10/3/19
to cesium-dev
I think what you want is to create a custom "destinationFound" function on the geocoder, that will both fly to that location and log whatever other custom event you want. However, it seems to be impossible to set this without manually creating the cesium viewer. I opened a bug report for this here:

Omar Shehata

unread,
Oct 3, 2019, 2:53:40 PM10/3/19
to cesium-dev
My bad. You can directly edit the destinationFound function from the viewModel. This should be a more reliable event:

viewer.geocoder.viewModel.destinationFound = function(viewModel, destination) {
    viewer
.camera.flyTo({
        destination
: destination
   
});
    console
.log("Going to", viewModel.searchText);
};



On Friday, September 6, 2019 at 2:31:58 AM UTC-4, san wrote:
Reply all
Reply to author
Forward
0 new messages