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

Copy location as <map-feature> #804

Merged
merged 5 commits into from
Mar 28, 2023

Conversation

prushforth
Copy link
Member

  • Change context menu to copy location as a map-feature.
  • Change Util._pasteLayer to sniff for <map-feature, paste as a visible layer.

Closes #779

Change Util._pasteLayer to sniff for <map-feature, paste as a visible
layer.
@prushforth prushforth requested a review from AliyanH March 22, 2023 19:08
Copy link
Member Author

@prushforth prushforth left a comment

Choose a reason for hiding this comment

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

I guess I should DRY the <map-feature> boilerplate, to avoid .js bloat. Also need to localize strings via mapml-extension PR.

@AliyanH
Copy link
Member

AliyanH commented Mar 22, 2023

How should we deal with the different "Coordinate system for location" options, for ex. I am not sure how helpful it would be to copy "tilematrix", "map" and "tile" as a <map-feature>. As pasting "map", and "tile" features causes an error, while pasting "tilematrix", displays the feature on the top left edge of the copied tile.

image

@prushforth
Copy link
Member Author

How should we deal with the different "Coordinate system for location" options, for ex. I am not sure how helpful it would be to copy "tilematrix", "map" and "tile" as a <map-feature>. As pasting "map", and "tile" features causes an error, while pasting "tilematrix", displays the feature on the top left edge of the copied tile.

I think for now I will log a message to the console, open an issue to fix this when the <map-feature> PR gets merged.

@prushforth
Copy link
Member Author

@AliyanH do you think the behavior is ok as far as pasting a new layer each time goes, or should it paste into an existing layer? Of course that will only work once the <map-feature> PR is merged...

@AliyanH
Copy link
Member

AliyanH commented Mar 27, 2023

@AliyanH do you think the behavior is ok as far as pasting a new layer each time goes, or should it paste into an existing layer? Of course that will only work once the <map-feature> PR is merged...

I think it makes sense to paste as a new layer with the localized label when pasting on to the viewer. Maybe in the future we can paste into layers through the layer control contextmenu?

Though the label you put for pasting features made me wonder, if we should change the default label for pasting layers/geojson with no label (to something similar: "Pasted layer"), currently it defaults to a localized string of: "Layer"
https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/main/src/mapml/utils/Util.js#L447
https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/main/src/mapml/utils/Util.js#L569

prushfor added 2 commits March 27, 2023 21:36
not implemented yet, uses gcrs as substitute location for those.
@prushforth
Copy link
Member Author

Depends on Maps4HTML/mapml-extension#54 for localization.

@prushforth
Copy link
Member Author

@AliyanH :

Though the label you put for pasting features made me wonder, if we should change the default label for pasting layers/geojson with no label (to something similar: "Pasted layer"), currently it defaults to a localized string of: "Layer"
https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/main/src/mapml/utils/Util.js#L447
https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/main/src/mapml/utils/Util.js#L569

Makes sense. I may update this and related PR to do that, tbd.

@prushforth

This comment was marked as duplicate.

@prushforth prushforth merged commit b5f67fd into Maps4HTML:main Mar 28, 2023
@prushforth prushforth deleted the copy-location-as-map-feature branch March 28, 2023 18:53
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.

"Copy > Location" should create a <map-feature> on your clipboard
2 participants