How to zoom on feature for any layer?

55
0
a month ago
ironmaskito
New Contributor II

Is it possible to zoom in on a feature in a layer-agnostic way? I am making use of the function goTo()  which accepts as parameters Geometry, Graphic, Viewpoint, a pair of coordinates or an Object with a combination of targetcenterscale and rotation properties. I would like to center on features from layers of different types be they GeoJSON layer or WMS Layer. So far I have not found any properties in Layer that would make it possible to extract feature information that can be passed into goTo().  I can do it by targeting certain layers, for example for GeoJSON I can parse it for geometry property and pass that to goTo() or use the graphics property in GraphicsLayer. But I was wondering if it is possible to do it in a universal way for layers as some like WMSLayer lack even basic feature information. 

Tags (1)
0 Kudos
0 Replies