Monday, March 21, 2016

Experimenting some more with map layers

One of the new nice features of Maps 3.20 is the ability of loading map layers in GeoJSON, KML, and GPX formats.
As I wrote about earlier, I have been experimenting with transit routing support. For that I have been using OpenTripPlanner, which has a notion of ”routers” (or “graphs“ as it could also be refered too) being discrete graphs consisting of nodes and connecting paths (such as transit routes) making up separate transit networks.
I thought it might be useful to get a visual picture of the sample data, so I got the idea of building a little tool that pulls the router information from a running OTP instance and generates a GeoJSON representation.

The code can be found here: https://github.com/mlundblad/otp-routers-to-geojson

This script, which by the way is my second case of using GJS as a scripting language, is rather simple and just takes as the one and only argument a URL to a running OTP instance (i.e. http://localhost:8080/otp when running a local server on your machine) and writes the output on stdout.

The script will skip any case where the graph's bounding polygon only consists of two points (not sure if that really would happen in reality).

Loading a generated layer into Maps can result in something like this:


The big diamond-shaped graph is probably the result of some malformed data, as that stems from the national transit feed from Estonia.

I hope you find this useful! :-)

Tuesday, March 8, 2016

View your tracks in Maps

Thought I should mention another nice feature that we have landed for 3.20, thanks to the nice work done by Hashem. Namely that you can now load GPX tracks recorded using i.e. a smart phone into Maps.

In the layers popover there is now a button to load geographical annotated data, it also supports loading geometries in GEO-Json format and KML (the format used in Google Earth).



This screenshot shows parts of a track recorded during a train trip (as you can see the track makes some jittery motions occasionally, but that is due to a bit shaky GPS reception).

Loaded layers shows up in the layers popover as shown below:


So now you can visualize trips and workout sessions directly in Maps. Also with shared-mime-info version 1.6 (which should be included in distros when shipping GNOME 3.20) double-clicking on a .gpx file should bring up Maps directly with the track loaded, as it registers itself as a mime handler for this mime-type.

The GPX track shown is awailable here https://cloud.gnome.org/index.php/s/G2YtwrveFo9RRjq
if you like something to play with.

Wednesday, March 2, 2016

A little teaser for future Maps

We've just entered the UI and string freeze for 3.20, we have a lot of new stuff coming up for Maps in 3.20 that I'm really excited about to see ”out the door”.

One thing that I've been wanting in Maps for a while is support for transit routing (for using public transportation options) in addition to our current ”turn-based” routing for car, bicycle, and walking powered by GraphHopper.

For a brief period in late summer took some time investigating the GTFS feed specification (for timetable data). The OpenTripPlanner project seemed rather fitting.

After a while of manually downloading some GTFS feed data and adding them to OTP's graph directory structure, I got a bit bored of that and wrote a little script to do the job https://github.com/mlundblad/otp-updater. It is quite crude and would probably need some better documentation (including a sample for the feed list configuration and such) and also currently requires quite a few command line parameters to point out the location for the OTP installation (used to run the graph rebuild command from there), these should probably be read from a global configuration by default…

Now, when things have calmed down a bit for 3.20 (and I wanted to try to keep main focus during my spare-time coding sessions getting the OpenStreetMap editing up to shape) I sat down and transformed the thoughts I've had in my head when it comes to integrating with an OTP server into a little proof-of-concept. The code is available in the https://git.gnome.org/browse/gnome-maps/log/?h=wip/mlundblad/transit-routing branch. The code is quite full of debug output code, is for the time being hard-wired to query an OTP instance running on localhost, and there's some duct tape here and there, but at least it does something…

OK, so enough of talking, now a little screenshot:


As you can here, there is now a new mode button to switch to transit mode. Currently, the only visible output is a raw debug dump of the JSON output from OTP. By the way, the blue route line shown in the screenshot is not actually from the transit routing, it's there since I first did the search using car mode and then switched to transit. And the reason it does a query also using the Estonian graph, seems to be some off coordinate in the data, I think.

I've also made a little list of feeds I've tried with here: https://wiki.gnome.org/Apps/Maps/Resources/GTFSFeeds

Running those feeds (plus a few more I had manually added before writing the updater script), the server takes around 7-8 GB RAM. So this would probably require a rather beefy machine to host the server.

Over and out for tonight! :-)