Skip to content

LayerSwitcher: use editor-layer-index for adding Custom layer 🎉 #298

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

Merged
merged 26 commits into from
Sep 4, 2024

Conversation

Dlurak
Copy link
Collaborator

@Dlurak Dlurak commented Apr 14, 2024

Integrate the layer index.

When adding a new layer a dialog opens where the user can select a layer:

image

In the next step the user is presented with some details like the description of the layer, here they also need to specify some parts of the url:

image

grafik

Todo:

  • Allow for overlays (Probably in a follow up pr)
  • There is a best attribute to a layer to indicate if it is the best source for an area, maybe show these with a star icon in the selector
  • Max/Min Zoom
  • Geographic limitations
  • Attributions

Copy link

vercel bot commented Apr 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Sep 4, 2024 4:29pm

Copy link
Owner

@zbycz zbycz left a comment

Choose a reason for hiding this comment

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

Wow, another great PR! Thanks 🙂 I planned to use editor-layer-index as well in future, but i think i wouldn't have enough priority for that 😅

I did only some preliminary code review as this is only a draft. Once you notify me, i will do a proper one. If you needed some help with the polygons i would be happy to (eg.over videocall or whatever you like) 🙂

@Dlurak
Copy link
Collaborator Author

Dlurak commented Apr 15, 2024

Actually the idea for the layer index is yours. (See issue #232)

@zbycz zbycz mentioned this pull request Jun 3, 2024
Copy link

vercel bot commented Jun 19, 2024

@Dlurak is attempting to deploy a commit to the OsmAPP Team Team on Vercel.

A member of the Team first needs to authorize it.

@Dlurak
Copy link
Collaborator Author

Dlurak commented Jun 19, 2024

While playing around with different layers I noticed this bug:

The Northern German west coast tidalflats (infared) layer has this url: https://imagico.de/map/osmim_tiles.php?layer=LC81960222015233LGN00ir&z={z}&x={x}&y={-y}. It seems like {-y} is not supported. Any idea how we could deal with this problem?

@Dlurak Dlurak marked this pull request as ready for review June 20, 2024 19:28
@Dlurak
Copy link
Collaborator Author

Dlurak commented Jun 20, 2024

@zbycz I think it should be fine now

Copy link
Owner

@zbycz zbycz left a comment

Choose a reason for hiding this comment

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

Great changes, thanks. I think we are getting there. As this is a big PR, i have few more questions. 🙂

Comment on lines 130 to 132

const { url, text } = attribution;
const innerHtml = createAttributionInnerHtml(attribution);
Copy link
Owner

@zbycz zbycz Jun 22, 2024

Choose a reason for hiding this comment

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

It seems attribution is ripe for refactoring, this is introducing technical debt.

I suggest always storing a react node in the attribution, if this is possible. Then we can construct here a rich object like below, we would make uniq array by keys, and then just output the React nodes. What do you think?

  • { key: 'maptiler', node: <MaptilerAttribution/>}
  • { key: 'URL/KEY-FROM-LAYER-INDEX', node: <a href="">...</a>}
  • { key: 'URL/KEY-FROM-LAYER-INDEX', node: <>...</>}

We can do it in followup, let me know, if you want to do it yourself or should I. Also if this is a followup it is usually cool to leave a comment saying sth like "TODO this will be refactored in a followup, link-to-issue". So the tech debt doesn't become unmaintainable 🙈

On the other hand if you want to do it here, merge master first, as this file was refactored and moved.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's the case now, right?

@zbycz
Copy link
Owner

zbycz commented Jun 22, 2024

The Northern German west coast tidalflats (infared) layer has this url: https://imagico.de/map/osmim_tiles.php?layer=LC81960222015233LGN00ir&z={z}&x={x}&y={-y}. It seems like {-y} is not supported. Any idea how we could deal with this problem?

@Dlurak I think we should show warning in such cases and not allow the user to save the layer.

const onClick = () => {
const TMS_EXAMPLE = TMS_EXAMPLES[counter % TMS_EXAMPLES.length];
counter += 1;
const url = prompt(t('layerswitcher.add_layer_prompt'), TMS_EXAMPLE); // eslint-disable-line no-alert
Copy link
Owner

Choose a reason for hiding this comment

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

As this PR removes the ability to submit custom URL, can we perhaps add Custom URL as a first option in the Autocomplete dropdown and display the input below?

Followup is ok. Let me know :)

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 3, 2024

Another problem that just occurred to me:
The user may have custom layers in local storage that aren't compatible with the new system from this PR. I guess the simplest and safest solution would be to simply use a different key for local storage. What do you think?

@Dlurak
Copy link
Collaborator Author

Dlurak commented Sep 4, 2024

@zbycz I think it should be fine now

@zbycz
Copy link
Owner

zbycz commented Sep 4, 2024

Yo! Thats a pretty good job on everything. 👍 🥇 💯

Merging right now! I am so happy to have this finished. I already heard some complains about outdated layers in OsmAPP on the OSM Discord, this will probably make many people happy. 🙂

@zbycz zbycz changed the title Layer index LayerSwitcher: use editor-layer-index for adding Custom layer Sep 4, 2024
@zbycz zbycz changed the title LayerSwitcher: use editor-layer-index for adding Custom layer LayerSwitcher: use editor-layer-index for adding Custom layer 🎉 Sep 4, 2024
@zbycz zbycz merged commit 2ce23f1 into zbycz:master Sep 4, 2024
2 checks passed
@Dlurak Dlurak deleted the LayerSwitcher branch September 30, 2024 22:37
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