I am using dynamic map service layer with basemap. Once I find feature using selectFeatures(), I want to center and zoom the selected feature. Consider only one feature has been selected. I use centerAndZoom() of the api and it works fine when no basemap available.
e.g. I provide my customers to specify one parameter value. If this parameter is specified as 2 then I calculate zoomFactor = 0.02 (i.e. 20% zoom in to the map) if no basemap available.
Now, if basemap is available then I can't use zoomFactor. How can I translate zoomFactor to level when basemap is available so, I can see the same output?
I tried to find level based on LODs. But I don't know which scale I should compare when traversing into LOD array.
I can have points, polygon or polyline features in my customers data. Even we support Roads and Highways extension so, m-aware features may be available too.
Before we were allowing to search features on map without basemap. We were just showing ArcGISDynamicMapServiceLayer on the map. Now, we added support for the basemap and performing projection using geometry service if needed. So, our efforts are that customers should be able to do same things with or without basemap. Then they won't feel the difference in behavior due to provided basemap support.
I am not finding a way right now to use a zoom percentage when working with a basemap. I always use the geometries extent expanded by 50% or if working with points I use a predefined zoomScale.
See the attached example and uncomment code for following cases as needed. The results are different with extent expand and centerZoom when basemap is available.
1) With basemap
b) Extent expand
2) Without basemap
b) Extent expand
I have also pasted screenshot for each cases in the attached doc for comparison.
Basically, I am trying to write the code such a way so, the map appears same with and without basemap whenever you change the zoomFactor.