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.
Bhavin,
So I take it that your features that you are selecting are points. Do you have some scenario in your app where there will not be a basemap?..
Hi Robert,
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.
Hi Robert,
Do you think there is any solution for this issue? Let me know if any clarifications you want.
Bhavin,
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.
Yes, I thought of using Extent's expand() function but it may not work in all cases.
Bhavin,
Can you give me a case where it would not?
Hi Robert,
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
a) CenterZoom
b) Extent expand
2) Without basemap
a) CenterZoom
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.
Bhavin,
You will probably never get them to match as the tiled basemap is confined to the LOD scales available in the tiled cache.