AnsweredAssumed Answered

What is the best practice to set map scale and layer's scale

Question asked by bforbhavin on Oct 1, 2015

I am using ArcGIS Javascript API to connect Mapservice published on ArcGIS Server. I am searching for the features in layer. Whenever I find features then I highlight them on the map as per Select with feature layer example. I use ArcGISDynamicMapServiceLayer.


Now, depends upon the mapscale and layer's scale the features can be highlighted. Let's say if the layer's scale is low and if you zoom out then the highlighted features won't be displayed. Another thing, if the map scale is too high then the highlighted feature may not appear. Even if it appears then user requires to manually zoom-in.


Now, the argument could be to publish mapservice as per need. But I have few customers, they publish map such a way so, whole map is displayed which is not best practice I guess. The expectation of the customer is whatever they are searching and the search result should be displayed automatically in proper extent.


Here I have questions:


1) How can I show the result of single as well as multiple features such a way so, feature can be displayed at appropriate zoom level regardless of the map scale or layer's scale? I tried graphicsUtils.graphicsExtent() and expand(factor). They work fine but still underlying map scale is considered and sometimes highlighted features may go out of the map boundary. The problem I have is customer's data is their data and not in our control since our solution is focused on the integration with ArcGIS Server and their data. We just render their data on the map and display it in our system.


2) Is there any best practice suggested to publish map service with map scale when using ArcGISDynamicMapServiceLayer?