Skip to content

Conversation

@BryonLewis
Copy link
Collaborator

@BryonLewis BryonLewis commented Nov 21, 2025

resolves #111

  • Adds vue-maplibre-compare dependency for comparing maps
  • adds useMapCompareStore to handle the isComparing as well as properties for comparison
  • Creates MapWrapper.vue to switch between default map and comparison map
  • Adds a mdi-compare button to selected Layers to toggle into comparison mode
  • Adds CompareLayersPanel.vue to panels that displays the left/right or top/bottom list of layers that can be toggled on/off for comparison. This doesn't include the ability to reorder or change styles or remove layers. To do that you need to go back to the main view
image

TODO:

  • Figure out why the maps have a 0 height when launched
  • Add the ouath.headers to the requests inside of the comparison library
    • Need to update vue-maplibre-compare for that to be updated
  • Probably add emits for zoom center pitch and heading so when returning back to the map it is is in the same location.
    • Confirm the emits are working
  • Fix Z-index issues with the compare map and the controls container
  • Decide on styling for the slider and coloring for dark/light modes
    • Maybe look into using the theme''s primary color so it stands out
  • Look into using the left map as the base map and sliding over the swiper when it's enabled
  • Change the compare layer display to have dragging.
  • Swap the mdi-cog action for a menu that would allow you to swap the currently displayed style
  • Look into trying to do this in a single list, where you have checkboxes for MapA and MapB and styles for MapA and MapB
  • Add support for removing/adding layers in the system
    • Update the list when adding/removing so the ordering is true to the list
  • Toggle on/off the base map
  • Left/Right map having different color styling
    • Style so that There is a single mdi-cog that enables tools to adjust left/right layer
    • Make sure changing the color doesn't turn the layer on
    • Vector map support
    • Raster map support
    • Opacity adjustment per left/right layer
  • Final Testing of reordering and any quirks with layering
  • Basemap toggling on/off and issues.

20251205 Updates/TODO:

  • Fix base Vector tile layer ordering issues. When toggling sometimes the order of the items in the baseLayer seem to change causing some visual issues
    • Expansion: the base map layer ordering if affected by the other ordering and it swaps back and forth.
  • Attribution text needs to be set for the ToggleCompare
  • Error when adding sources that already exists (specifically being in compare mode and attempting to add a new source)

Reviewer Questions:

  • Keep Map.vue (original Map tool) and MapWrapper.vue (the reloading system) or only use the new ToggleCompare.vue
  • Please do a quick overview of https://github.com/BryonLewis/vue-maplibre-compare and see if there aren any issues or modifications needed.

TODO 20251216:

  • MapB (second map) item selection and tooltip support
    • Going to require adding all of the 'click' actions and events on the layers
    • Update the centering of the map to take in account the slider. Currently it attempts to center based on a full map and not the portion for MapA. MapA and MapB need to be able to center based on their corresponding sizes.
      • This will probably require an event stating the ratio of the comparison slider from inside of vue-maplibre-compare to know how to center the map
  • Basemaps don't change on MapB. Assuming this is some Async issue with style.json being requested and loaded. During testing it seems that the MapB basemap is one step behind the right one. I may have to do some async code when the basemap changes to handle this.
    • When using a single URL for the style.json and loading it needs to process the style.json to get the layers and then load up the corresponding layers. This is what is causing the async problem with changing map base layers while in comparison mode.
  • Add support for Horizontal and Vetical comparisons.
    • Add maybe a hover state to the compare button that opens a v-menu allowing the user to swap between vertical and horizontal orientation
    • Update all references to left/right to be top/bottom
    • Makes sure that the reloading by changing the orientation works properly with everything
  • Reorient the CompareLayerStyle.vue
    • Right/Left orientation for the vertical compare
    • Top/Bottom orientation for the horizontal compare
  • Minor Issues
    • Changing basemap will reset the styling to the MapA item
    • Changing basemap will reset the opacity display
    • Changing the style will reset the opacity display

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 21, 2025

Deploying geoinsight with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a632c2
Status:🚫  Build failed.

View logs

@BryonLewis BryonLewis marked this pull request as ready for review December 8, 2025 17:50
Copy link
Collaborator

@annehaley annehaley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I opened the modified files in my own vscode environment, I noticed highlighting for whitespace inconsistencies and unused imports. Could you comb through modified files for those? We may need to update our client linting to catch those.

Comment on lines 30 to 35
const currentLayerStyles = computed(() => {
return {
A: compareStore.compareLayerStyles.A[styleKey.value],
B: compareStore.compareLayerStyles.B[styleKey.value],
}
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have a saved style selected for each layer when I enable compare mode, this is not populated with the current selected styles.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it so it should grab the default style if it is specified in the compareStore when loaded.

e33a7e2

Comment on lines 185 to 188
<v-card-text class="pa-2">
<v-row>
<v-card width="400" flat color="transparent">
<v-card-title>{{ compareStore.orientation === 'vertical' ? 'Left Map' : 'Top Map' }}</v-card-title>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this would look too crowded, but when the comparison orientation is vertical (and we have left vs. right maps instead of top vs. bottom), can we organize the two style selections in this menu to be side-by-side instead of stacked? The visibility checkboxes are side-by-side, so let's try to maintain that spatial relationship when we can.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes based on the compare mode:
image

image

Added in: 9a632c2

Comment on lines 118 to 125
const getBaseLayerSourceIds = () => {
const map = mapStore.getMap();
if (!map) return [];
return map.getStyle().layers.filter((layer: any) => {
const layerWithSource = layer as { source?: string };
return layerWithSource.source?.includes('openstreetmap');
}).map((layer: any) => layer.id);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a similar function with the same name in the map store. They have different logic, though. Can you reconcile this so only one getBaseLayerSourceIds exists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize I actually need a getBaseLayerIds for usage in the ToggleCompare.vue component because the visibility is dependent on the layerIds and not the sourceIds. I created that new function when integrating/merging the user basemaps. Still need to fix some issues with loading the basemap in the secondary (MapB) map.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a different function in map.ts getBaseLayerIds in f4f0a2a

@annehaley
Copy link
Collaborator

As for the reviewer questions in the description:

  1. Keep Map.vue (original Map tool) and MapWrapper.vue (the reloading system) or only use the new ToggleCompare.vue

I think we should consolidate wherever possible, so let's try just using ToggleCompare.

  1. Please do a quick overview of https://github.com/BryonLewis/vue-maplibre-compare and see if there aren any issues or modifications needed.

Without the structure of a PR review, where would be the best place to put comments and track conversations? Should I start a google doc for it?

@BryonLewis
Copy link
Collaborator Author

Without the structure of a PR review, where would be the best place to put comments and track conversations? Should I start a google doc for it?

Feel free to either do a google doc or if you feel they are actual changes/features that are needed place them as issues in the repo.

@annehaley
Copy link
Collaborator

Before doing a more thorough review of https://github.com/BryonLewis/vue-maplibre-compare, I have a high-level question to confirm my understanding. The library's README explains that three components are available: MapCompare, LayerCompare, and ToggleCompare. From my understanding, we only use ToggleCompare in GeoInsight (because we need to turn compare mode on and off). MapCompare is intended for comparing basemaps, and LayerCompare is intended for comparing other layers on top of a common basemap.

Is it possible to write all of this functionality into a single component? It seems that our use case on GeoInsight will need all of that functionality. After #250 (sorry for the complexity that PR adds to this one), we will want the ability to compare maps with different layer sets (with different styles) and different basemaps, and we still need the ability to toggle compare mode. Unless there is a technical reason that they need to be separate, I'm imagining that one component could offer all of those features.

@BryonLewis
Copy link
Collaborator Author

With the updated basemap user layers basemaplayers are layers that don't container .raster. or .vector. Check the updated code here: https://github.com/OpenGeoscience/geoinsight/blob/master/web/src/store/map.ts#L214.

Also remember that the layer ordering for sub-layers inside a vector pmtiles needs to be preserved as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced Interactions for Layer Comparison

3 participants