run viewer.geocoder.viewModel hidden

Hello,

When I run this code:

var geocoder = viewer.geocoder.viewModel;
geocoder.searchText = 'Spain';
geocoder.flightDuration = 0.5;
geocoder.search();

The search window is open with text "Spain"... there's an option to hidde this text window to user?

I use keepExpanded=false but box text still open...

Thanks

Generally the main purpose of the view models is to programmatically control the user interface. If you just want to do a background geocode without affecting the user interface, you could simply use the underlying GeocoderService directly by calling geocode, then take the first result and call flyTo.

https://cesiumjs.org/Cesium/Build/Documentation/GeocoderService.html

https://cesiumjs.org/Cesium/Build/Documentation/Camera.html#flyTo

Hello Scott Hunter

Do you have an example, please?

Thanks

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var geocoderService = new Cesium.IonGeocoderService({

scene: viewer.scene

});

geocoderService.geocode(‘spain’).then(function(result){

if (Cesium.defined(result) && Cesium.defined(result[0])) {

    console.log(result[0].destination);

    viewer.camera.flyTo({

        destination : result[0].destination

    });

}

});

``