Bug 344237

Summary: Export geo: URI
Product: [Applications] marble Reporter: Josef Kufner <jk>
Component: generalAssignee: marble-bugs
Status: CONFIRMED ---    
Severity: wishlist CC: dllud, mdione, nienhueser, stanciumarius94
Priority: NOR Keywords: junior-jobs
Version: 1.9 (KDE 4.14)   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: The GPS coordinates input widget at mapy.cz

Description Josef Kufner 2015-02-16 13:23:27 UTC
Since marble can open geo: URI using --geo-uri option, it would be nice to support the other direction -- to easily extract location in form of geo: URI from marble to clipboard.

Reproducible: Always

Steps to Reproduce:
1. Place cross to desired location
2. Press ctrl+c / select "Copy geo: URL" from menu
3. Switch somewhere else
4. ctrl+v will paste geo:xxx,xxx

Actual Results:  
So far there is only mostly useless option to get coordinates in wierd textual form, which different from most other formats (like any other "human-friendly" format).
Comment 1 Dennis Nienhüser 2015-02-19 19:57:56 UTC
Somehow related: Settings => Configure Marble => View => Angle: "Degree (Decimal)" switches to a slightly less weird textual format.
Comment 2 Josef Kufner 2015-02-19 20:17:01 UTC
Good point, Dennis, however, "a slightly less weird" is still a pretty wierd ;)

Take a look at http://mapy.cz/zakladni?x=14.4294224&y=50.0795464&z=16&source=stre&id=122632 in the bottom of the sidebar, there is "GPS" link (second from bottom). When you click it, a input with coordinates appears (see attached screenshot).

This input has a little arrow at right which changes format of the coordinates in the input (unfortunately it does not have geo: URI, but that is easy fix). I believe such widget could be very useful in Marble and in Qt libraries in general.
Comment 3 Josef Kufner 2015-02-19 20:17:46 UTC
Created attachment 91186 [details]
The GPS coordinates input widget at mapy.cz
Comment 4 Dennis Nienhüser 2015-02-19 20:42:12 UTC
One possible improvement would be to extend our current status bar (where the position is shown) to allow for a quicker way to change the display format. E.g. by extending its context menu, which only has one entry "Show tile zoom level" so far. Or -- easier discoverable -- have it react to left mouse clicks, or embed some button even. That needs some careful UI design thinking though.

One issue to solve however is that currently the angle units are identically used to format values to be shown and to be copied. A geo: prefix IMHO does not make sense to show in all places, but mostly just for the copy to clipboard operation. One solution could be to extend the current "Copy coordinates" action into a submenu with entries for all possible (sensible) formats.

@Torsten: Do you think changing the "Copy coordinates" action into a submenu with copy actions using different angle formats is a good approach?
Comment 5 Marius Stanciu 2015-02-20 13:58:24 UTC
Hello! May i suggest this course of action :

http://s27.postimg.org/g5y4baijn/suggestion.jpg

(sketch I've made in gimp :D )

After thinking for a while, I've came to the conclusion that the FORMAT in which marble exports coordinates via the copy-coordinates action is an option users would RARELY need to change. So changing the action to a sub-menu would impose the user to choose this format setting every single time they copy some coordinates, fact that might become annoying.

On the other hand, having a default format and giving the user the possibility to easily change it in the settings menu is a more appropriate solution.

If this seem alright, i'd really like to implement it, as i'm new around here and i need a chance to get involved somehow. 
Also i'd like to give bug https://bugs.kde.org/show_bug.cgi?id=344364 a try as well. 

Let me know if this seems feasible and i'll start working on the patch(es) right away.
Comment 6 Josef Kufner 2015-02-20 15:13:34 UTC
I really like this sketch. You are right, there are really only two formats user needs: machine-friendly geo: URL and wierd human-friendly format (which is rarely changed). Question is, how often user needs both.

What about adding the third option to edit menu? Now I see two options in "Edit" menu: "Copy map" and "Copy coordinates". I think we can simply add "Copy geo: URL". The option in settings could choose which one will be used by Ctrl+C shortcut.
Comment 7 Dennis Nienhüser 2015-02-20 19:33:39 UTC
One thing we didn't discuss in detail yet is what the coordinates that are copied are used for. Usually you'd want to feed them to some other software or website, or store them in a text file. While in the latter case you can format it the way you like best, whenever you feed them to some other tool it's not really your choice how to format them -- the tool decides. Therefore I'm afraid we should rather support several common formats at the same time.

So instead of having an option in the settings I'd provide a submenu like this: http://nienhueser.de/marble/copy-coordinates-mockup.png

This might not be enough yet, though. There's the possibility to write coordinates in the order lon,lat and also in the order lat,lon. Both ways are commonly used unfortunately. See https://en.wikipedia.org/wiki/ISO_6709#Order.2C_sign.2C_and_units and https://help.openstreetmap.org/questions/12450/coordinate-format-latlon-vs-lonlat for a start.

We shouldn't add any combination we think of, however. Instead do some reasearch what formats common tools like OpenStreetMap, Google Maps, Google Earth, Bing, .... accept and settle on a common ground.
Comment 8 Josef Kufner 2015-02-20 21:53:20 UTC
I don't like submenu like this. As Stanciu stated, user typically changes coordinates format rarely. It is more like setting it once and never change it again. It is annoying to target the one correct format in the menu again and again.

I see three things to copy from Marble: Map (picture), textual coordinates and geo: URI. So there should be three items in menu.

Format of the textual coordinates should be configurable, as it is now, but having few more formats is important for cooperation with other tools, as Dennis stated.

The menu with many formats is useful only if Marble and all other tools used by user cannot be configured to use the same format.

If we want to address all use-cases without making it hard to use, we need both. What about menu like this:

  - Copy map
  - Copy coordinates
  - Copy geo: URI
  - Copy in other format
      - ... submenu with all available formats.

The "Copy coordinates" would respect user's preferences and use the same format as the rest of the application. "Copy in other format" would offer all formats that are available in preferences. I don't consider geo: URI as one of possible formats since it is not designated for being read by users.

Downside of this approach is that it requires four items in "Edit" menu. So far there are only three other menu items, so it is not a problem, but I can't recommend to use this approach too often -- too many menu items make it hard to find the right one.
Comment 9 Dennis Nienhüser 2015-02-21 09:24:23 UTC
The problem with the settings dialog is discoverability: As a user I wouldn't expect a simple copy action to be configurable. So if the copy action doesn't produce the output I'd want, I'd curse at the program, but would not search the settings menu for a way to change it.
There might be a way around it though and have the copy action behave like the "edit maps" action does: Bring up a dialog showing the available choices, along with an option "use this setting in the future and don't show this dialog again (can be changed in the settings dialog)".
Then you'd get a dialog the first time to choose which format you want, and either more dialogs in repeated calls or have it stick to the format you selected.
Comment 10 Marius Stanciu 2015-02-21 10:19:51 UTC
I've also thought about the discoverability problem, and that sounds like a great solution in the end!
Comment 11 Josef Kufner 2015-02-21 11:24:22 UTC
Since the copy format would be the same as format everywhere else, I wouldn't worry about discoverability too much. One note under format select box in settings dialog will make it clear.
Comment 12 Dennis Nienhüser 2015-02-21 14:14:37 UTC
Well the point about discoverability is that we don't expect users to enter the settings dialog at all.
Comment 13 Josef Kufner 2015-02-21 17:09:29 UTC
Well, the settings dialog is the first thing I open when I don't like something. And format option is on the first page of the dialog, so I wouldn't worry about that too much.
Comment 14 Marius Stanciu 2015-02-21 22:29:16 UTC
I consider Dennis's approach to be the most appropriate as it solves both the potential discoverability issue and the repeated setting nuisance.  I'm eager to implement it yet i'm in a dilemma: should i start working on the patch or should i wait for more opinions to eventually settle a common ground?
Comment 15 Josef Kufner 2015-02-21 23:00:12 UTC
Go for it.

There may be somedetail to change later, but imperfect solution is better than none.
Comment 16 Marius Stanciu 2015-02-24 19:46:16 UTC
OK i've almost completed the patch, but i have a couple of issues on which i want your opinion:
http://postimg.org/image/aieqt5s3x/
http://postimg.org/image/fdpuk9mlv/

The Copy Coordinates function now pops a dialog  which enables the user to preview and change the format in which the coordinates will be copied. Dialog won't appear next time if the checkbox is checked.

Issues:
1. To enable the user to still change the format setting, i had to include the combobox into the settings dialog. Is the View tab a good placement for this combobox?
2. Shall the "Don't show this dialog again " thingy last for the current session only? or should it be saved as a permanent setting?
3. The Copy Coordinates function was implemented twice and DIFFERENTLY in the original source code. Once for the Edit> Copy Coordinates action, and once for the right click menu on the marble widget.

Were these two actions supposed to be different? One simply copies a string to the clipboard, the other builds a quite complex QMimeData object.

As that seemed weird to me, I have centralized the code into a new class,  to maintain code clarity.
In my implementation, both Copy Coordinate actions now do the same thing( except that Edit one gets the center of the widget, while the right click one gets the cursor coordinates ).
Comment 17 Josef Kufner 2015-02-24 19:56:39 UTC
I would add note to copy dialog, that the format can be changed in settings. Except that, it looks good. Thank you!
Comment 18 Marius Stanciu 2015-02-25 20:52:29 UTC
submited it at https://git.reviewboard.kde.org/r/122725/
Comment 19 dllud 2017-02-22 23:38:14 UTC
Any plans to add this feature anytime soon?
It would be really handy to share locations with friends.
Comment 20 Marcos Dione 2021-09-30 13:48:55 UTC
Can we vote for bugs?