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

Open in external app/site with coordinates. #1076

Closed
jesade-vbg opened this issue May 4, 2022 · 8 comments · Fixed by #1081
Closed

Open in external app/site with coordinates. #1076

jesade-vbg opened this issue May 4, 2022 · 8 comments · Fixed by #1081
Assignees
Labels
idea new feature Request for adding/changing functionality
Projects
Milestone

Comments

@jesade-vbg
Copy link
Contributor

jesade-vbg commented May 4, 2022

We've had a discussion about this a few months ago.

Anyways I've made a POC that my collegues liked. Basically it's all coded (well not in the AdminUI).

We need to be able to open a link with the currently centered coordinates applied. So a dynamic link will be generated.
The generated url will simply just open in a new tab/window what clicked.

In config a link will look like this (Example Google street view):
https://maps.google.com/?q=&layer=c&cbll={y|EPSG:4326|4},{x|EPSG:4326|4}

The string {y|EPSG:4326|4} in the link will be replaced with the Y-coordinate from Hajk.
The string {x|EPSG:4326|4} in the link will be replaced with the X-coordinate from Hajk.
The coordinate will be converted from EPSG:XXXX to EPSG:4326 thats the projection that Google uses as input.
And finally we cut the coordinate to 4 decimals. (4 is also default).

So the object in the url has this format:

{
  x or y,
  projection,
  number of decimals (optional, defaults to 4)
}

It is also possible to use {zoom} in the urls which is useful if you link to another Hajk-map (In our case, Geodatabanken).

Here is some other configuration examples (Also, see screenshot):

{
  "name": "Geodatabanken",
  "uri": "https://geodatabanken-test.varberg.se/?m=map_1&x={x|EPSG:3007|0}&y={y|EPSG:3007|0}&z={zoom}&l=1618%2C1842"
},
{ 
  "name": "Snedbilder (Slagboom en Peeters)",
  "uri": "https://app.slagboomenpeeters.com/varberg?x={x|EPSG:3007|0}&y={y|EPSG:3007|0}&z=12&mode=oblique&minimap=open"
},
{
  "name": "Google Street view",
  "uri": "https://maps.google.com/?q=&layer=c&cbll={y|EPSG:4326|4},{x|EPSG:4326|4}"
},
{
 "name": "Google maps",
 "uri": "https://maps.google.com/?q={y|EPSG:4326|4},{x|EPSG:4326|4}&ll={y|EPSG:4326|4},{x|EPSG:4326|4}&z=20"
},
{
  "name": "OpenStreetMap",
 "uri": "https://www.openstreetmap.org/#map=19/{y|EPSG:4326|4}/{x|EPSG:4326|4}"
}

Screenshot:
image

One issue is the icon used to toggle the menu, it is also used for "Share/Dela". But the icon is mostly used as a "Open in external application"-icon.

Let me know your thoughts!

I will soon push my code to a feature branch.

@jesade-vbg jesade-vbg self-assigned this May 4, 2022
@jesade-vbg jesade-vbg added the idea label May 4, 2022
@jesade-vbg jesade-vbg added this to Approved ideas in Hajk via automation May 4, 2022
@jesade-vbg jesade-vbg added this to the 3.10 milestone May 4, 2022
@jesade-vbg jesade-vbg added the new feature Request for adding/changing functionality label May 4, 2022
@jesade-vbg jesade-vbg modified the milestones: 3.10, 3.x May 4, 2022
@jesade-vbg
Copy link
Contributor Author

@jacobwod
Copy link
Member

jacobwod commented May 5, 2022

Looking forward to trying it out, seems like a nice addition!

I agree that the icon seems correct here, but we will need to handle the conflict between this and the other plugin using it (by finding something better for the other one I guess).

@jacobwod
Copy link
Member

jacobwod commented May 5, 2022

A small suggestion: perhaps a try/catch in the handleItemClick method, in case the regex parsing is messed up and an exception is thrown?

@jesade-vbg
Copy link
Contributor Author

A small suggestion: perhaps a try/catch in the handleItemClick method, in case the regex parsing is messed up and an exception is thrown?

A small but good suggestion 👍

@jesade-vbg
Copy link
Contributor Author

Would this icon be wrong for "Dela"?
https://mui.com/material-ui/material-icons/?query=share&selected=Share

Maybe the "Dela" tool will have additional Share-methods in the future. For example Share on instagram, share on facebook etc etc.

Just thinking...

@jacobwod
Copy link
Member

jacobwod commented May 5, 2022

I agree, the icon you suggest is way better for the Anchor plugin than the current one. Feel free to change!

@jacobwod
Copy link
Member

jacobwod commented May 6, 2022

This looks really good. Regarding Admin: perhaps it would make it easier if Admin provided some presets to some of the more common services (Google Maps, OpenStreetMap, Google StreetView)? This would make it very easy to enabled the preferred services.

@jesade-vbg
Copy link
Contributor Author

Sure, I'll se if I can find a good sollution for this.

@jesade-vbg jesade-vbg linked a pull request May 10, 2022 that will close this issue
@Hallbergs Hallbergs modified the milestones: 3.x, 3.10 May 12, 2022
@Hallbergs Hallbergs moved this from Approved ideas to Done in Hajk May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea new feature Request for adding/changing functionality
Projects
Hajk
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants