My eventual goal is to be able to return the map to an extent which surrounds all map features on the client side. Since there does not appear to be a way to easily do so entirely on the client side, I decided the easiest thing to do would be to calculate a bounding extent on the server and pass it to the client every time new map elements were added.
Setting the CurrentExtent property of a map on the server side does not necessarily ensure that is the extent of the viewport on the client side (which makes sense to prevent distortion as a result of having a viewport with weird dimensions). However, there is no way that I can find what the extent that the viewport will have on the client will be. This would not be an issue if setting the CurrentExtent property on the server side had the same result as calling the zoomToExtent property on the client, but for some reason they have different results.
Another option would be to send the center of the extent (since setting CurrentExtent to A on the server and calling zoomToExtent(A) on the client both result in a viewport with the same center), and the scale that will be used to display the extent on the client, but the CurrentScale property on the server does not update when CurrentExtent is set - it only seems to be set on postback.
So my question is, on the server, is there a way to determine either:
- The extent of the viewport on the client given a known CurrentExtent property on the server
- The scale which will initially be used on the client given the CurrentExtent property on the server