Esri / data-collection-ios

Mobile data collection app using the iOS Runtime SDK.
https://developers.arcgis.com/
Apache License 2.0
25 stars 26 forks source link

Set new initial viewpoint to map view when switching from working online to offline #152

Closed mikewilburn closed 5 years ago

mikewilburn commented 5 years ago

When a user has an offline map and switches from working online to working offline, it's possible for the offline map to open at an unknown location, leaving the user swimming in a lattice of grey "no data" without any indication of scale or whereabouts.

This is because the present behavior has deterministic rules that attempt to preserve the user's online map extent as best as possible.

If this online map view extent is nowhere near the location of the already-downloaded offline map, this can make it exceptionally difficult to navigate to that area. Even worse, if the user has altogether forgotten where the offline map exists, such behavior could make it altogether impossible to locate the area covered by the offline map.

I propose:

mikewilburn commented 5 years ago

@esreli that is just one recommendation as to how we might go about solving this. There are bound to be many other valid solutions. Just didn't want to log a problem without offering a possible solution :)

esreli commented 5 years ago

@mikewilburn this change has been implemented as follows (in meta code):

if map is offlineMap and currentExtent intersects offlineMapExtent, set visibleArea to currentExtent. else if map is onlineMap, set visibleArea to currentExtent.

Would you verify this has been implemented properly?

mikewilburn commented 5 years ago

@esreli There are still a few circumstances in which this isn't working.

I'm guessing a bit here, but I think this logic breaks down because the offlineMap's scale can never be smaller than the coarsest LOD at which the offline map is available. So while that intersection evaluation is probably written soundly, when you:

set visibleArea to currentExtent

some of the extent-setting behavior might be getting overridden by the centerpoint of the currentExtent being preserved, but at a sometimes greatly zoomed in scale at which the offline map is well outside of the visibleArea. This means you're dropped into this lattice of grey and would only be able to navigate to the offline map if you knew precisely in which direction to pan and by how much.

I can show you more of this in person, because that's pretty hard to decipher in writing.

mikewilburn commented 5 years ago

By contrast, it looks like the .NET app permits zooming out beyond the initial extent that was used to capture the offline map: image

esreli commented 5 years ago

@mikewilburn This poses an interesting question. Should the app:

a) Permit the offline map's scale to the map's minScale (as far zoomed out as the map will allow)? b) Re-calculate the last session's viewpoint to account for scale requirements c) both a & b?

mikewilburn commented 5 years ago

If I'm understanding correctly here, I think just a) would be sufficient. I think it would be fine to allow the user to zoom out as the .NET version of the app does.

esreli commented 5 years ago

Sounds good.

esreli commented 5 years ago

With this technique, I must note- for any map that is already downloaded, the scale will remain at what is was specified at the time of the download.

So, this fix will only fix all maps moving forward and won't account for any maps that have already downloaded.

esreli commented 5 years ago

@mikewilburn the change has been implemented. Specifically, the offline map's minScale is set with the same value as the online map's.

In order test you will have to use a new downloaded map. Any existing downloaded maps min/max scale values will persist.

mikewilburn commented 5 years ago

This looks good to me @esreli.

From testing a bit, I was able to conclude the following two behaviors:

Example when toggling to offline map from online mode: image