Going to the zoomed view of a particular 3Dbuilding using an URL in cesium API

I have a cesium application which shows 3d buildings for an area. What I want is if I give some URL it should go to the zoomed view of a particular building. Say for ex: if I givehttp://localhost:8383/Cesium_3D_Buildings/Apps/Sandcastle/gallery/GeoJSON_Hubli_3D.html/Kims central library it should go to the Kims central library building with the zoomed view. I know it can be done somehow by fly to but is is possible using a URL in cesium API?


Cesium provides a helper function for processing query strings called queryToObject. That can help you get information from the url, like www.myapp.com?location=kims%20central%20library

(%20 is the URL coding for a space)

If you have a way of knowing the lat/lon coordinates associated with the location name, you can then use flyTo to zoom to the location.

Otherwise you can try searching for the name using the geocoder widget,

You can do

viewer.geocoder,viewModel.searchText = locationName;





I can get the name of each building by entities[x].properties.name. And if the name given in URL matches the entities.properties.name it should go to viewer.flyTo(entities). I don’t have any idea in using queryToObject for this purpose. Help would be appreciated.

It would be easier if there is any examples.