Bug 329512 - Provide URI scheme for Marble data views
Summary: Provide URI scheme for Marble data views
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Other
: NOR task (vote)
Target Milestone: 1.8 (KDE 4.13)
Assignee: marble-bugs
URL:
Keywords: google-code-in, junior-jobs
Depends on:
Blocks:
 
Reported: 2014-01-01 22:40 UTC by Marcus Harrison
Modified: 2014-01-03 20:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Support for --geo-uri parameter for bin/marble (2.06 KB, patch)
2014-01-02 14:47 UTC, Dennis Nienhüser
Details
~/.kde/share/kde4/services/marble.protocol (200 bytes, text/plain)
2014-01-02 14:47 UTC, Dennis Nienhüser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Harrison 2014-01-01 22:40:22 UTC
Feature request. Provide a URI scheme for marble views, including centre co-ordinates and zoom level. By providing a scheme such as marble:// or map://, this allows one to store marble views with associated resources, such as in websites or in KOrganizer events.

Currently Marble only provides a means to copy human-readable co-ordinates such as  10° 00' 04.8"E,  53° 33' 00.5"N. However, there is manual work in opening the application, copying the co-ordinates to the clip-board and pasting them into the search box that could be aleviated with clickable links in many applications and on websites. A URI scheme would allow one to click a link to perform all of these steps automatically, even if Marble is not currently running.

Marble with Open Street Maps is quickly replacing Google Maps and OpenStreetMaps.org for me, but this feature provides one area where the latter two are still the more convenient.

Reproducible: Always
Comment 1 Dennis Nienhüser 2014-01-02 14:45:12 UTC
You can use the --latlon and --distance parameters of Marble to set center and zoom values on startup, e.g.
$ marble --latlon=49.0,8.41 --distance=1.5

That doesn't help for URI style links though. Attached is a patch for the Marble KDE application to register another parameter --geo-uri which parses (basic) http://en.wikipedia.org/wiki/Geo_URI strings. Basic as in supporting longitude, latitude and altitude which should be all we need.

It can be combined with a custom protocol handler that registers with KDE to react to geo: URIs (also attached). With both around clicking on the geo: URIs in Wikipedia with some browser then opens up Marble at the given place (center coordinate and zoom level) here.
Comment 2 Dennis Nienhüser 2014-01-02 14:47:01 UTC
Created attachment 84412 [details]
Support for --geo-uri parameter for bin/marble
Comment 3 Dennis Nienhüser 2014-01-02 14:47:51 UTC
Created attachment 84413 [details]
~/.kde/share/kde4/services/marble.protocol
Comment 4 Dennis Nienhüser 2014-01-02 14:57:23 UTC
Remaining work:
- Move parser from kdemain.cpp to its own class
- Add the --geo-uri parameter to the Qt application as well
- Install a suitable marble.protocol file with cmake
- Create a unit test for the new parser class which ensures that Geo URIs can be parsed successfully
Comment 5 Dennis Nienhüser 2014-01-02 15:25:44 UTC
GCI task is at http://www.google-melange.com/gci/task/view/google/gci2013/5847453085466624
Since it's possibly not available publicly, here's a paste:

"A 'geo' URI is a URI scheme defined by the Internet Engineering Task Force's RFC 5870, see http://en.wikipedia.org/wiki/Geo_URI. This task is about installing Marble as a handler for such URIs. Clicking on a link like geo:37.786971,-122.399677 will then open Marble at the given location.

=> Have a look at the bug report 329512. It contains an initial implementation for that feature
Create a class GeoUriParser with a method bool parse( const QString &uri ). It should return true iff the given string is a valid Geo URI. Use the regular expression from the initial patch to implement this. Store the coordinate parsed in a member variable. Create a method GeoDataCoordinates coordinates() const in GeoUriParser which returns this member variable.

=> Change kdemain.cpp to support --geo-uri parameters like in the initial patch, but make it use the new GeoUriParser. Check your implementation by opening Marble like
marble --geo-uri=geo:-25.0064,153.359,250
You should end up on Fraser Island with this one (Great Sandy National Park in Queensland, AU)

=> Add the same feature (handling a --geo-uri parameter) to the Marble Qt application and test that it works in the same way

=> Create a file marble.protocol in src/apps/marble-kde and have cmake install it appropriately in the KDE services directory. See how marble_part.desktop is installed. The content of the file should be identical to this one, but with the exec path fixed (no path needed, just marble). If you find documentation about .protocol files, check the other fields and adjust as needed

=> Create a unit test tests/GeoUriParserTest. Provide a couple of valid and invalid geo URIs and check that they are parsed/rejected correctly

=> Create a review request"
Comment 6 Levente Kurusa 2014-01-03 19:22:36 UTC
I implemented this in commit: 258f3402a45d8d7a0fe62d4138d7925bace5d8d9
You can take a look at the commit here: http://commits.kde.org/marble/258f3402a45d8d7a0fe62d4138d7925bace5d8d9

We can close the bug now.