Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for viewing local geojson layers #524

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

floryst
Copy link
Contributor

@floryst floryst commented Oct 22, 2024

Users can now visualize local geojson files in RD-WATCH.

Screen.Recording.2024-10-22.at.3.19.43.PM.webm

Nice-to-haves and other considerations:

  • toggle layer visibility
  • nicer layer names (based on what?)
  • edit geometry styles
  • should the annotator view also support viewing local geojsons?

Other changes:

  • The map is no longer partially covered by the sidebar
  • An event is used for triggering map.fitBounds() instead of a state variable
  • minor whitespace changes that were automatically done by my editor

Copy link
Contributor

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

Sorry about the delay in reviewing this, just a couple of suggestions.

As usual some future features not needed for this PR (mostly just thoughts):

  • May be nice to integrate with tooltips and present a table of the properties for a feature, or perhaps selection and provides a table of the properties for the selected features. There could be metadata associated with their geometry that help distinguish items.

Comment on lines +166 to +168
map.value?.removeLayer(`local-layer-${id}:fill`);
map.value?.removeLayer(`local-layer-${id}:outline`);
map.value?.removeSource(`local-source-${id}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

This was something done before my time with the project, but toggling different modelRuns basically rebuilds the entire data passed to the model. That means that switching tabs to the model runs and turning on any model run will make the local geoJSON features disappear. It may be necessary to add some data to the the sources in the main style function:
https://github.com/ResonantGeoData/RD-WATCH/blob/main/vue/src/mapstyle/index.ts#L34

Not the way I would do stuff if starting from the beginning (I'd rather use maplibre's addSource/addLayer) but you probably need to add an additional function here to make sure the localGeoJSONs don't get disabled when running.

:key="layer.id"
:title="`Layer ${layer.id}`"
>
<template #append>
Copy link
Contributor

Choose a reason for hiding this comment

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

Besides focusing and deleting it may be nice to toggle layer visibility on/off.

<v-list-item
v-for="layer in localLayers"
:key="layer.id"
:title="`Layer ${layer.id}`"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine for a Layer to begin with a Static Id like this when initialized, it may be nice to have an edit field that way a user can upload multiple layers and give them some reasonable name. Just an edit button and allowing the user to rename locally for organizational purposes.

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.

2 participants