metacatui icon indicating copy to clipboard operation
metacatui copied to clipboard

Set Viewfinder zoom height based on latitude and longitude decimal precision

Open robyngit opened this issue 1 year ago • 0 comments

The soon-to-be released Viewfinder will allow users to zoom to any location on the map by entering lat, long pairs. For the first release, the view zooms to the coordinates at a hard-coded camera height, see https://github.com/NCEAS/metacatui/blob/9d551a3762640d9e8dc03810b2a842ba5f7603c8/src/js/views/maps/ViewfinderView.js#L103

As @iannesbitt suggested:

One possibility would be to zoom tighter based on the number of decimals supplied by the user, so for example entering 42,-71 might give you a zoom level that includes most of the state of Massachusetts, whereas 42.7, -73.1 might zoom to the town of North Adams. A calculation that makes this possible in a 2-D map wouldn't be too hard I don't think—we could just zoom to a bounding box that includes ± the last decimal values in the query to get rough extents to zoom to. This might be somewhat harder in an application like Cesium, however, and may need its own feature request depending on whether others think this is a good idea.

To summarize: zoom level should be much lower at least, and at most may be able to be calculated based on the decimal precision.

robyngit avatar Feb 13 '24 21:02 robyngit