Terrastories / terrastories

Terrastories is a geostorytelling application for mapping, managing and sharing place-based stories.
https://terrastories.app
MIT License
319 stars 157 forks source link

[Map] add an overview map (aka mini-map) #216

Closed rudokemper closed 5 years ago

rudokemper commented 5 years ago

It would be good to have an overview map added to the map. This is a small map to be placed in the corner of the main map, giving a broader overview of the current map extent/zoom level. Here a demo of Esri's ArcGIS Online equivalent: https://developers.arcgis.com/javascript/3/jssamples/widget_overviewmap.html

Some work has been done on the Mapbox github pages to get this going:

https://github.com/mapbox/mapbox-gl-js/issues/6914 https://github.com/aesqe/mapboxgl-minimap

agustinariq commented 5 years ago

Hello! Can I try this one?

kalimar commented 5 years ago

Yeah definitely! Thanks. Please let us know if you have any questions.

agustinariq commented 5 years ago

Hello! I'm working on this issue and I was wondering if you could give me feedback on how it looks so far.

The border was added with the browser inspector.

Screenshot from 2019-10-16 18-00-16

I have some questions:

I used Aesqe's map plugin. The interaction is very similar, I used different zoom configurations though.

rudokemper commented 5 years ago

Thanks, @agustinariq! Very cool! I think the placement and style is great, and in my opinion, the minimap probably isn't necessary for mobile.

Is it possible to set the zoom extent of the minimap? The reason I ask is that most of our Terrastories maps are not actually set to the whole world; they are limited to zooming out to the extent of a country, for example. Can the minimap be set to the maximum zoom extent of the map, as defined by the user?

agustinariq commented 5 years ago

I think the placement and style is great, and in my opinion, the minimap probably isn't necessary for mobile.

Great :+1:

Is it possible to set the zoom extent of the minimap?

Yes, it is possible. The zoom of the mini-map changes along with the main map. Generally, the mini-map is set to have 2 points less of zoom.

For example: This is the initial position when the page loads

Screenshot from 2019-10-17 13-14-51

and when you zoom the main map, the mini-map changes

Screenshot from 2019-10-17 13-15-16

The reason I ask is that most of our Terrastories maps are not actually set to the whole world; they are limited to zooming out to the extent of a country, for example.

Sorry, I don't quite get this part :persevere: Is the user, in some cases, not able to see the whole map?

rudokemper commented 5 years ago

Ah, I think I understand now; the mini-map extent/zoom is set to the initial position. That's great.

What I meant is that for some of the maps, there are boundaries to where you can pan and zoom. For example, in the map you just posted, the user wouldn't be able to move beyond the extent of North America. So then it doesn't make sense to have a mini-map showing the whole world.

But, if the initial position of the mini-map -- that is, the background map, not the highlighted box showing the zoom extent -- is set to the initial view of the map, that resolves the problem :)

agustinariq commented 5 years ago

But, if the initial position of the mini-map -- that is, the background map, not the highlighted box showing the zoom extent -- is set to the initial view of the map, that resolves the problem :)

Great then!

Anyway, we can review this again when I open the pull request :blush:

rudokemper commented 5 years ago

Sounds perfect! Thank you :)