Closed rsargent closed 2 years ago
Some background:
'Base Layer" field in a layer definition specifies a base layer that also gets turned on with a particular layer. It stems from legacy scenarios where the layer creator observed that a particular layer really only pairs well with a specific base layer. This paired base layer is currently only turned on when a user is physically clicking through the layer menu and chooses a layer with a pre-defined paired base layer. This ensures that no matter what base layer was previously up, the base layer that the original layer creator thought paired best is thereby utilized.
When a user comes by a share link, this share link has a combination of layers encoded in it. These layers came from the user manually clicking through the menu. It's likely that the originator of the share link has turned on a specific combination of layers and because of this, we most likely don't want to use the pre-paired base layer of any of these layers. For example, the originator of the share link may have turned on a layer that auto pairs with bdrk and wanted more detail, thus manually choosing bdrk_detailed.
In a story, waypoints are defined by share links and thus utilize the logic stated above.
Now you can see the assumption here is that share links are not manually constructed but rather EarthTime itself does it. There should never be a case that a base layer is absent from a share link because the system would never give you a share link like that. However, if the system doesn't see any base layer in a share link, it will default to Landsat. To add to this, you note in a story that clicking the second waypoint and then back to the first does show bdrk_detailed. This is because the system didn't see any base layer defined in the first waypoint and kept whatever base layer was already up (as set by the second waypoint). When first arriving at the story no base layer was ever up, which is why Landsat was then used.
That all said, logic could be added that if no base layer exists in a share link, to look at the pre-paired base layers of all the other layers and thus choose the one with the highest draw order. However, I would argue that share links should be explicitly defined to show exactly what you want, which is what EarthTime would do when generating the link for you. So if one is doing this manually then one should also do that.
Thanks for tracking down the root cause.
I guess I'd advocate that either we make the case of unspecified basemap deterministic (ideally trying to honor layer requested basemaps in some way as you describe), or that we set up some way to give feedback to an author that the waypoint is underspecified and therefore will have results that are not deterministic. There would clearly be some benefit to being able to provide an author feedback on how a story might have syntax or other errors.
There will always be reasons people edit waypoints, and even if that's not the case, we should assume that waypoints could have problems introduced in any number of ways, until such time we only use an editing front end that enforces correctness.
FWIW, in addition to the different behavior between initial visit and click-to-visit, the thumbnail itself also appears to match the initial visit rather than the "click" logic.
Should be resolved in commit b3d7de8
Please confirm. Note that to regenerate the waypoint thumbnail with the right background, just tweak the lat/lon of the share link slightly to force it to regenerate.
The behavior now is that if no base layer is present in a share view, it will look to the other layers that are part of the link and find a paired base layer with the highest draw order (if there is more than one it can pick from). If there are no paired base layers defined for any of the layers, it will default to Landsat.
@arwright can you confirm? (This is deployed to earthtime.org and proxies)
I confirm that the new behavior matches Paul's description and is no longer dependent on how the waypoint is accessed. Thank you.
To reproduce, browse to:
https://earthtime.org/#csvlayers=11t8XP5yipm-8aceGU-wcr-qIjg-kFTASY1IZVoQ8M4Q.1706635433&waypoints=11t8XP5yipm-8aceGU-wcr-qIjg-kFTASY1IZVoQ8M4Q.0&theme=anne_test&story=anne_choropleth_test
First waypoint appears, with Landsat background
Click on 2nd waypoint then back on first, and waypoint now appears with dark map background.
The story waypoint does not specify a basemap, but the choropleth layer does specify dark map. We should consider making behavior consistent between visit by URL and visit by click icon. Author prefers in this case that both would use dark map, and/or that we better document what the "Base layer" specification in CSV layers means.