stamen / maperture

https://stamen.github.io/maperture/
MIT License
39 stars 12 forks source link

Allow three or more map panes to be compared #5

Closed almccon closed 2 years ago

almccon commented 2 years ago

It was bound to happen eventually, but it happened for me pretty quick... I'm in a situation where it would be really handy to have three panes.

The swipe tool wouldn't work in this case, instead it would have to be three linked side-by-side views.

Could we implement this easily? And what are the UI implications? Would we want the option to add/remove that third pane, or to potentially add n panes? Could this work if we had a toggle between the "swipe" mode and "side-by-side" mode? But if you're in three-pane side-by-side view and then you want to switch to swipe mode, would it just drop one? Or prevent you from switching to swipe....? hmm.

aparlato commented 2 years ago

I would guess if we're hitting situations where it would be helpful to compare 3 styles, it isn't a stretch to think we'd want to compare 4 (or more) at some point.

Could this work if we had a toggle between the "swipe" mode and "side-by-side" mode? But if you're in three-pane side-by-side view and then you want to switch to swipe mode, would it just drop one?

I would think, rather than drop a view, we might think of the compare mode (allowing and adding more views) as the primary app state. Then we could have an option to select 2 of those views for compare with a swiper (in a modal).

Here's an extremely rudimentary sketch to illustrate my thought (not to fully mock up exactly how this would work):

No views selected (white text box under map lets you use url to point to style): image One view selected (option to edit style json): image Two views selected (gives option to compare): image (modal with compare tool): image

Could we implement this easily?

With this proposal, I don't believe we'd be able to implement easily from the existing code. This would be a bigger more holistic refactor.

@peterqliu what are your thoughts? Is there an easier lift or do you think a request like this warrants thinking through bigger changes?

peterqliu commented 2 years ago

@almccon in thinking through the tech lift, I've got a straw man for you to 👍 / 👎 :

When we're asking for a "three pane", we really just need a quick way to toggle between pairwise comparisons. We might want look at differences between 3+ styles, but can only ever see two at a time: A to B, B to C, A to C.

If this is true then the challenge gets significantly easier (just a matter of setting up the matchup easily, rather than all at once).

aparlato commented 2 years ago

I think one other factor to consider is how much change this tool is likely to go through in the near future. @peterqliu has done a great job getting something good and useful together quickly. Are we at the point that we know more of our requirements and this is coalescing into something that should be more robust?

Depending on that and the turnaround time needed, we might consider taking this opportunity to build this from components we can reconfigure as needed. For example:

When we're asking for a "three pane", we really just need a quick way to toggle between pairwise comparisons. We might want look at differences between 3+ styles, but can only ever see two at a time: A to B, B to C, A to C.

If time to something useful is still our primary metric though, I think @peterqliu 's solution is clever. That said, do we already know there's a use case for seeing all variants at the same time or is that speculation?

almccon commented 2 years ago

Regarding the use cases for 3+ panes, I did a very cursory search through screenshots on my FB laptop (the one project where I've had a 3+ pane viewer available) to see how frequently I used three panes. In this case it's useful to remember that you get two panes by default when you load, so it does take a tiny bit of motivation to go and add a third. I also found some cases where the QA teams had their workflow set up to automatically start with 3+ panes.

As a very rough guess, I'd say that 95% of my screenshots were two panes, but 5% of the time I had 3 or more.

Use cases for 3+ panes:

This is a pretty narrow set of use cases and they're all really just a "nice to have" situation. I'm kind of talking myself out of the request that 3+ panes is really that useful. But maybe this list is helpful for others' thinking?

peterqliu commented 2 years ago

This is helpful. After thinking a bit about the polypane use case, I think we should keep the current swipe tool for two styles, and a separate tool for >2 styles. Rationale:

New compare tool for >2 panes

I think the solution to comparing many styles, is actually showing just one pane at a time, and making it easy to switch between them.

Downsides

aparlato commented 2 years ago

@peterqliu I understand your assessment, but as a counterpoint: I feel like more tools might actually be more maintenance and, in use, lead to fatigue for cartographers when the use cases are so similar (compare 2 vs compare 3+).

Based on conversations, it sounds to me like this tool is something we want to start moving to become customer agnostic (and longstanding), and if so is worth considering building out for expanded use cases rather than start a new tool.

Based on that, my take would be to either create a solution here or hold off until we have a larger use case.

I think the solution to comparing many styles, is actually showing just one pane at a time, and making it easy to switch between them.

With this solution, is this drastically different than just switching the style in one of the panes as-is? It seems like this is already possible, even if not optimized, and I'm reading the request as 3+ maps side by side. @almccon what do you think?

peterqliu commented 2 years ago

Based on conversations, it sounds to me like this tool is something we want to start moving to become customer agnostic

I share this dream, but after working on project-specific tooling and fulfilling their cartographic feature requests, the dream feels remote. Without getting specific here, a majority of those features are unique to some file system setup, or a niche map inspection workflow, or a live-reload system based on some file structure, or some other project-specific need.

While we do want to pull out generalizable patterns into this tool, potentially open-sourced for other people on other projects, it is unlikely to be satisfactory for many of Stamen's, without heavy customization (i.e. turning this into something completely different). cc/ @ebrelsford might have thoughts on this too

I feel like more tools might actually be more maintenance

from the above train of thought, I suspect this tool will stay generic and pretty rudimentary, which suggests minimal changes in the future. But even when it IS necessary, I think the separation actually reduces maintenance load: a tool that toggles between two things is likely to have more complexity, than two self-contained pages that each does something simple.

To use an extreme case, we can make a monster tool that combines all the mapbox gl examples into one, but I bet that would be harder to debug and maintain than keeping them as loose HTMLs.

aparlato commented 2 years ago

I see, thanks for laying out this context @peterqliu, this is helpful for me to understand the scope and constraints!

But even when it IS necessary, I think the separation actually reduces maintenance load: a tool that toggles between two things is likely to have more complexity, than two self-contained pages that each does something simple.

I think I misread "make another tool" to include starting a new repo initially, so it sounds like you're imagining 2 HTML files that both live here. In my mind, even switching between the two independent HTML files via an <a> link effectively makes it a single tool, but now I think I'm on the same page here (even if we choose not to link them). Based on what you've written above, this sounds like it makes sense!

peterqliu commented 2 years ago

Built what I had described in https://github.com/stamen/mapbox-gl-compare/issues/5#issuecomment-1025413523 over on the [multi] branch here (put it on a block if you'd like to play with it).

Per chat with @almccon, he is still refining the problem that this tool is meant to solve, so we can back burner this until more clarity materializes.

ebrelsford commented 2 years ago

I'm happy to hold off on talking about this until Alan chimes in with some more clarity about the use case. Where possible, I would like to make a tool that uses components and is relatively generic, then fork that tool for specific client uses. I agree that we shouldn't try to force every feature into this tool, but on the face of it I think having more than two panes is a reasonable ask.

ebrelsford commented 2 years ago

Now that #9 is merged I'm interested in us working on this. My proposal:

RossThorn commented 2 years ago

In line with these changes, even when looking at just two styles, I also would find it useful to have both map styles have identical side-by-side views rather than swipe. So what would be the default for >2 views, but also just for two views as well!

Sometimes a change is just to see if something is present in one or the other and always having to slide just adds a little more mouse mileage to the use than needed with a mirrored view.