So for my mapview, I'm doing runtime calculation of extent and setting it to view.extent property.
Our requirement calls for the home button to restore the default view which is equal to the derived extent.
Our map also needs to be responsive, so once a browser dimension changes, the home button needs to re-calculate the extent that is applicable to the current browser viewport dimension.
Looking at the 4.6 Doc, it appears we can define a Viewpoint that augments how the home behaves. However it's not obvious how viewpoint relates to extent.
I've custom logic that calculates the new extent upon a widthBreakpoint and heightBreakpoint change. However, I don't see how that new extent can be used to derive a new viewpoint, which the home button requires. Thanks
So that sounds like I would need to update the view extent upon a browser resize via view.extent. Then I can have the updated scale and center values to instantiate the new viewpoint.
The issue with this approach is each browser resize will reposition the map per the new extent. The desired behavior is to not to change the extent upon browser resize - Only update the viewpoint for the home button so that when the user clicks home, the view he sees is equivalent to the extent for the current browser size. Does this make sense?
So I've been searching for some 101 articles that articulates the concepts of scale, zoom, extent, viewpoint, especially how they relate. Haven't had any luck. Do you know of any such articles? Thanks.
I'm looping through the features in all my layers to find the xmin, ymin & xmax, ymax values in that collection.
The notion of and extent replacing the centerpoint + zoom makes total sense to me. I'm struggling to understand how the concept of viewpoint replaces replaces extent.
These seem like fundamental mapping concepts that I need a better understanding of.
I see why you are asking about my extent algorithm. Upon further reading, it looks like I can derive the extent via setting the combination of centerpoint and zoom value. Does the latter provide a more seamless pattern to deriving the Viewpoint? I believe the viewpoint needs the scale value. I still need to understand how does zoom map to scale.
With this approach, the new challenge I see if being able set a zoom level that provides sufficient buffer/padding around my map features. With my current extent algorithm, I can expand the extent by a ratio amount like 20%. By using the zoom value to control the size of the bounding box, I don't see a programmatic way to control the amount of padding around my features.