(Translated by https://www.hiragana.jp/)
GNOME Maps and the tile problem [LWN.net]
|
|
Subscribe / Log in / New account

GNOME Maps and the tile problem

By Nathan Willis
July 27, 2016

The GNOME project's Maps application provides access to an array of mapping features (trip routing, address lookup, zoomable maps, etc.) from the desktop. Implementing that feature set requires hooking into a number of online services, but none of them is as prominent as the map tiles—the background images on top of which everything else is added in overlays. Recently, the tile provider that had served GNOME Maps well for several years ended its free service, suddenly cutting off all of GNOME Maps's users and forcing developers to consider new approaches for the future.

Since its initial public release, GNOME Maps had used the open tile API offered by commercial map vendor MapQuest to fetch its map tiles. Like a lot of online mapping providers, MapQuest incorporates OpenStreetMap (OSM) data into its own product offerings, a usage fully allowed under OSM's licensing (and surely a significant cost-saver for the company). In order to give back, MapQuest announced its OSM-based service in 2010.

GNOME Maps, in turn, made use of the MapQuest open tile data because it is end-user-ready—unlike the raw data provided by OSM itself. Although OSM does have a publicly accessible tile server, in practice that server acts as more of a technology demonstration or development aid than it does a full-blown public web service, and access to the tile server is limited. OSM's primary focus remains on creating and editing the map data itself.

To put it another way, ultimately OSM produces a data set; it does not run a public service. And the limitation is a technical one, too, not mere policy. Any end-user service built on top of the OSM database must, at the very least, perform its own filtering and other transformations (selecting which road and path types are of interest, dropping authorship and update information, perhaps selectively choosing land-usage type, points-of-interest and other metadata, and so on). On top of that, its must render the map data into images and apply appropriate labels and markers, plus undertake all of the tasks of running a large-scale public web service.

For years, MapQuest's free OSM-based service did just such processing, supplying ready-to-use PNG image tiles. But, in June, MapQuest abruptly changed its usage policy, making the existing free service unusable and steering existing users toward a new, paid service. The new MapQuest service did advertise a free tier, but with an API cap far too low to work for GNOME Maps.

The official shutdown occurred on July 11, causing GNOME Maps (and many other services and applications) to display a repeating display of MapQuest's shutdown announcement in place of map tiles. On July 13, Maps co-maintainer Jonas Danielsson wrote to the development list, calling attention to the service shutdown and warning that the project has "no clear alternative" for a map-tile source.

He noted that there were patches available that could switch Maps over to OSM as a direct tile source, but added that "we would probably violate the terms of service" unless GNOME could convince OSM to grant it an exception. He asked for help contacting OSM, but concluded: "I think we are going to need our own tiles.gnome.org for a map application/platform to be feasible."

GNOME could perhaps run a server that fetched and cached OSM tiles for Maps users without raising the OSM project's ire, although it is not clear whether or not such a caching server would run afoul of OSM's rate-limiting rules and require asking for special permission. And, certainly, a caching server could act as a temporary solution, something that could be swapped out in the future for a GNOME server that generated its own image tiles directly. But, as Emmanuele Bassi noted in a Reddit discussion thread, the computing power for the server may be doable, but the bandwidth could rapidly become a problem.

PNG image tiles are typically 256 pixels square but, for any given area on the map, they must be generated at multiple resolutions—OSM supports 20 zoom levels, and users like to zoom in and out at will, expecting the image tiles to be served up nearly instantaneously. Multiplied by all of the GNOME Maps users, that adds up to a lot of network traffic.

One hypothetical alternative would be to render the tiles locally. The map server could send vector data for the region of interest and have the user's CPU or GPU render the data directly to screen. Danielsson noted that such client-side rendering is an item on the Maps roadmap, but it is several steps from being practical. OSM's vector-tile API is still in the experimental stage (as there are additional challenges to solve, such as clipping paths to bounding boxes), for one thing.

But users may not like vector-tile rendering either. Local rendering would cost battery power, and it could introduce lag. The Android app OsmAnd already uses client-side rendering, and OsmAnd users will no doubt be familiar with the delay experienced after panning or scrolling to a new area on the map, waiting for the roads and buildings to render on screen.

Another approach suggested on the list was having the application fetch map tiles in advance and store them locally. GNOME Maps can already run in local-tile mode, if one downloads tiles for the area of interest ahead of time. But this was also regarded as suboptimal; it requires the user to dedicate considerable disk space to store map tiles even in the best of circumstances, and the space required to store the entire OSM global map is hundreds of gigabytes.

In the long run, GNOME may have to run its own tile server. There would certainly be advantages to having control over that bit of critical project infrastructure. In the interim, however, the project seems to have come across a viable substitute. Przemo Firszt suggested reaching out to any of the several OSM-based service providers geared toward developers. One of those service providers, Mapbox, responded a few days later with an offer to give GNOME Maps free access to its tile server for a year.

Danielsson and Mattias Bengtsson then discussed the offer with Mapbox and agreed to the switch, with Bengtsson adding: "Personally I'm interested in exploring how we could continue with Mapbox in even in the future. It might mean crowdfunding in some way."

The MapQuest bug is listed as a blocker for the release of GNOME 3.22, so implementing the fix via Mapbox is a high priority. But it could still be a while before the patched application reaches end users; Ubuntu was already forced to pull Maps from its installation images for the most recent stable update to Ubuntu 16.04 (although the package could easily be restored in the next update). The Maps team has tentatively planned to discuss a long-term solution a few weeks from now at GUADEC.

The series of events is frustrating for Maps users, of course, but it is worth remembering that the root of the trouble is MapQuest's sudden reversal of its original pledge to support the open-source community. Reliance on the external service led to the disruption, which would be the case regardless of whether that service was free or proprietary.

But, at present, reliance on third-party resources for map applications seems to be unavoidable due to the size and complexity of global mapping. GNOME Maps already relies on quite a few other services to provide functionality on top of the tile layer, including Nominatim, which converts addresses to map coordinates, GraphHopper, which calculates routes, and so on. That makes it susceptible to interference on a number of fronts—even if outages like the current one remain a rare occurrence.


to post comments

GNOME Maps and the tile problem

Posted Jul 28, 2016 5:35 UTC (Thu) by javispedro (guest, #83660) [Link] (7 responses)

Hmm. Wouldn't local rendering actually save power and reduce lag? I fail to see how rendering a single tile would take more than a 20 MS round-trip to a remote server. And turning the radio on at all consumes a lot of power.

Maps were rendered almost in real time decades ago using Agg on 400Mhz computers, and there are routine demos of full speed map panning in modern desktop computers (see Qt blog). In fact, my experience with OSMand is that it is faster in almost any situation except very low latency USB links. And OSMand is not even the fastest renderer around (Java?).

Even Here maps (the web based one) is using vector maps behind the scenes; rendering them using JavaScript, and the performance is more than acceptable. I believe Google Maps is doing something similar too these days (before that, the tiles loading process was very noticeable).

It does have a cost in disk space, though.

Vector graphics maps

Posted Jul 28, 2016 12:29 UTC (Thu) by tajyrink (subscriber, #2750) [Link]

My thoughts too, it has been done, it's just far from the simplicity of fetching png files, so most free software applications don't have it implemented (GNOME Maps, uNav, FoxtrotGPS, ..) or it's slow/buggy (Navit). OSMand is an excellent app and I wish I could get a good vector graphics based navigation app on my Ubuntu phone. uNav is great otherwise though and generally very usable.

Tile based maps take huge amount of space if cached locally, while I had most of Europe on my Openmoko as vector graphics in around 6 gigabytes in 2010. I was using Navit, and yes it was especially slow at 400MHz but it did work for me for car navigation.

GNOME Maps and the tile problem

Posted Jul 28, 2016 17:50 UTC (Thu) by andrewsh (subscriber, #71043) [Link] (2 responses)

Maps.me have actually published the source code of their application (though I haven’t managed to build it), that could be reused I guess.

GNOME Maps and the tile problem

Posted Jul 30, 2016 0:37 UTC (Sat) by angdraug (subscriber, #7487) [Link] (1 responses)

OsmAnd is (and AFAIR has always been) GPL, and so is likely to have more new contributor friendly source code. Also OsmAnd is a lot more tweakable app than maps.me, which is also likely to lend to an easier to deal with code base (can't efficiently support and develop a codebase across that many combinations of options without having a process to deal with tech debt). And it's been around longer than maps.me.

GNOME Maps and the tile problem

Posted Aug 4, 2016 14:01 UTC (Thu) by moltonel (guest, #45207) [Link]

On the other hand, maps.me renders the map much faster than osmand (you don't even notice it's doing a rendering step each time). But their open source policies leave some things to be desired (https://github.com/mapsme/omim/issues/3623).

Or they could get inspiration from KDE's Marble, which has been able to use multiple providers (tiles and routing) from the start, has a good caching mechanism, has made good progress with vector rendering, and has basic OSM editing functionality.

GNOME Maps and the tile problem

Posted Jul 28, 2016 20:15 UTC (Thu) by zlynx (guest, #2285) [Link] (1 responses)

Vector maps should be very fast. Game engines handle far more complicated graphics at 60 FPS.

The data does need to be structured properly. One trick for fast vector rendering I recall reading about is to make sure long lines have points even where they don't need them in order to guarantee at least one point in each visible area of the space partition tree. And I think those extra points can be dynamically generated from the previous zoom level. Otherwise your code is back at calculating all kinds of extra line intersections just to see if it's visible or not. And of course priority levels so that tiny features aren't being included when zoomed far out.

I suspect that, like much modern software, lots of programmers just go for brute force instead of cleverness. "Let's just draw EVERY line and find its intersection with the view! Yeah! And instead of a regular BSP with an insanely fast binary search we'll have these local object bundles with irregular edges (eg, the state of Maryland) and we'll run a view intersection test against every bundle to see if we should be drawing those." Etc.

GNOME Maps and the tile problem

Posted Jul 31, 2016 8:03 UTC (Sun) by alex (subscriber, #1355) [Link]

The rendering is fairly easy to setup. The setting up of GIS aware database and importing the data set is a pain. In a previous life I had to implement tile rendering on an NMS system. The biggest problem was having to break up the OSM data dumps into reasonable sized chunks for each country. Importing the whole of the UK data-set would make our rather lightweight server chug away for a significant amount of time - I dread to think what it would do to a normal laptop.

Maybe the circle can be squared with having a public GIS web-service to supply the vector data but I suspect that still runs into the same problems of maintaining a web-service getting hammered for data with no monetary backing to keep it running.

GNOME Maps and the tile problem

Posted Aug 4, 2016 14:35 UTC (Thu) by moltonel (guest, #45207) [Link]

Client-side rendering is not the same as offline rendering. The vector data can either be downloaded ahead of time in a few big blobs, or on the go using smaller tiles. Depends on how fresh you want your data to be, wether an upfront download and big local cache is acceptable, etc.

GNOME Maps and the tile problem

Posted Jul 28, 2016 7:49 UTC (Thu) by TomH (subscriber, #56149) [Link] (3 responses)

I think you'll find it would take rather more than "hundreds of gigabytes" to download the entire world as rendered tiles - last time we tried to estimate it we came up with 54TB which I think was down to zoom 18 before we added the 19th zoom level.

At zoom 19 there are over 250 billion tiles just for that level, so over 500 billion in total for all levels up to 19 but at the higher levels very few are ever looked at - just 0.023% of z19 tiles had been recently viewed last time we checked (all figures from https://wiki.openstreetmap.org/wiki/Tile_disk_usage) because of course much of the world is water, or otherwise largely empty and hence not commonly viewed at large scale.

All of which goes to explain why we absolutely prohibit any bulk downloading of the tiles from tile.openstreetmap.org - because doing so forces us to render things that would otherwise likely never be rendered.

Many people assume that the tiles are all prerendered and they are just downloading what already exists but that isn't actually what happens at all - rather tile.openstreetmap.org is a network of currently about 18 reverse proxy caches around the world (https://hardware.openstreetmap.org/#tile-caches) which sit in front of two rendering servers that render tiles on demand, and expire ones that haven't been requested recently.

Currently at peak times that cache network is delivering a little over 1Gbit/s of tile data to our users and (as you can see at http://munin.openstreetmap.org/openstreetmap/tile.openstr...) that rose 10% or more when MapQuest shutdown their service.

Network of mirrors?

Posted Jul 28, 2016 9:56 UTC (Thu) by Yenya (subscriber, #52846) [Link] (2 responses)

Would it be feasible to use a similar approach to what Linux distributions use? There are lot of servers willing to do mirroring and donating their own bandwidth and disk space - getting the content from upstream via rsync and serving it to other users via http/ftp/rsync. Maybe Openstreetmap should provide an easy way to do contribute.

FWIW, I maintain a moderately-sized mirror site (ftp.linux.cz), and I am willing to donate a disk space in the order of several terabytes and bandwith in order of about 1-5 Gbit/s.

Having the tiles rsyncable is probably not feasible because of their large number, but the simpler the contribution set up would be, the more contributors the Openstreetmap project gets. Maybe the data set should be split geographically, and then have "mirrors of European tiles", "mirrors of Australian tiles", etc. Would Openstreetmap be interested in something like this?

Network of mirrors?

Posted Jul 28, 2016 15:51 UTC (Thu) by smoogen (subscriber, #97) [Link]

Looking at where the reverse proxy caches are hosted, they are using similar method to various linux distributions for "live" data. They are relying on various hosting services to give them a server that they can use for the proxy server. I expect that any static data storage of the tiles would only go down ~15 levels deep before it got too expensive to store in a useful format.. and most people are probably wanting data at zoom level 17->20 versus those top 15.

Network of mirrors?

Posted Aug 4, 2016 14:17 UTC (Thu) by moltonel (guest, #45207) [Link]

Makes me wonder why Gnone doesn't "simply" contribute/sponsor a few tile caching servers to the existing OSM ones ? Presumably the setup is fairly straightforward at this stage. Add enough serversto make sure Gnome users don't overload the currently available bandwidth, and share the work with the community. Unless there are so many Gnome Maps users that Gnome would need to sponsor a rendering server too ?

GNOME Maps and the tile problem

Posted Jul 28, 2016 14:58 UTC (Thu) by pj (subscriber, #4506) [Link] (1 responses)

Have they considered something p2p like IPFS? If each running app had an IPFS node in it (or required a local IPFS node) then that would help with all the bandwidth and distribution problems: gnome or whoever would just have to run a node and pin all the tiles so they'd be persisted even if no apps were running.

GNOME Maps and the tile problem

Posted Jul 28, 2016 20:28 UTC (Thu) by magila (guest, #49627) [Link]

IPFS isn't mature enough to handle this workload. In particular IPFS has scalability issues with addressing large numbers of objects. Pinning an object in IPFS incurs a minimum overhead of a few hundred bytes per hour to maintain an entry in the DHT. That may not sound like much, but pinning ten million objects would require several megabits per second even if none of the objects are being downloaded.

GNOME 3.22 release blocker?

Posted Jul 29, 2016 5:34 UTC (Fri) by zdzichu (subscriber, #17118) [Link] (2 responses)

I appreciate the amount of work needed to create working application. I understand the problem faced in July by Maps authors. What I don't get is why this is a release blocker?
To be blunt - I don't see the point in GNOME Maps app. There are few online services with mapping and routing (OSM, Google Maps, Bing...), why is a thick client even wanted? It could be included in GNOME as leaf application, but it is not important enough to block release of whole environment.
I have the same feeling about Weather app. Sure, it looks nice, but it's entirely pointless (just put "weather" into google search box). And those aren't self-sufficient apps, they need data sources and infrastructure to provide it.

GNOME 3.22 release blocker?

Posted Jul 29, 2016 8:07 UTC (Fri) by rsidd (subscriber, #2582) [Link] (1 responses)

+1. How many GNOME users would be upset if it was released without maps? The majority probably use the browser or their mobile phone anyway.

GNOME 3.22 release blocker?

Posted Aug 4, 2016 14:20 UTC (Thu) by moltonel (guest, #45207) [Link]

I know I'd be upset if KDE was released without Marble :p But I'm a map geek (and OSM contributor) and use a good dozen different map apps/websites regularly :)

GNOME Maps and the tile problem

Posted Jul 30, 2016 17:19 UTC (Sat) by patrakov (subscriber, #97174) [Link] (5 responses)

I think that local rendering is the way to go. Use case: laptop with an LTE modem, I am in a foreign country, so traffic is very expensive.

GNOME Maps and the tile problem

Posted Jul 30, 2016 20:55 UTC (Sat) by gioele (subscriber, #61675) [Link] (2 responses)

> I think that local rendering is the way to go. Use case: laptop with an LTE modem, I am in a foreign country, so traffic is very expensive.

Beware: in many heavily edited urban parts of the OSM map the raw data is bigger than the rendered PNG tile.

(One could say that in those cases a picture is worth a thousand nodes.)

GNOME Maps and the tile problem

Posted Jul 31, 2016 15:06 UTC (Sun) by jospoortvliet (guest, #33164) [Link]

Would there be no way to benefit from or work with the Marble team on this?

See http://nienhueser.de/blog/?p=688 for some info about their approach.

GNOME Maps and the tile problem

Posted Aug 4, 2016 14:30 UTC (Thu) by moltonel (guest, #45207) [Link]

Pretty much nobody (appart from OSM editors) use the raw OSM data to render. They all do some initial filtering, keeping only the data they know to interpret, and sometimes simplifying the geometry. Some extract a region and convert it to a binary format more suited to rendering/routing. Some put the extracted data in PostGIS and render pngs tiles from there. Some do the same step but render vector tiles instead.

Vector tiles has been the focus of a lot of OSM development in recent years, because they are much more flexible (think changing the display language, optionaly show buildings, etc) while puting a lower load on the server. But it's difficult, and hasn't overtaken png tiles in popularity yet.

GNOME Maps and the tile problem

Posted Jul 31, 2016 18:22 UTC (Sun) by sator77 (subscriber, #45045) [Link] (1 responses)

I agree, and with the switch to Mapbox we get the possibility of fetching vector tiles as well.
The problem is the local rendering. It is not all that trivial with many gotchas to render a _nice looking_ map. But if we manage, by for instance using Mapbox own mapbox-gl library in some way, we get more control of the style of the map. And could, for example offer a high contrast Map in the high contrast theme.

Or if someone wants to try to turn my toy library vectortiles-glib (https://github.com/jonasdn/vector-tile-glib) in to something real, that would also work.

Jonas (Maps maintainer)

GNOME Maps and the tile problem

Posted Jul 31, 2016 18:57 UTC (Sun) by TomH (subscriber, #56149) [Link]

I'd be careful about basing anything on the Mapbox vector tiles because Mapbox do not openly license those - they consider the selection of what data appears in the vector tiles proprietary and are currently making legal threats against people who have attempted to create compatible vector tiles that provide the data needed for Mapbox's (openly licensed) styles - see https://github.com/osm2vectortiles/osm2vectortiles/issues... for one example.

Basically if you build a style on the Mapbox vector tiles you won't be able to switch to another data provider without rewriting the style because nobody else will be able to provide compatible vector tiles.

GNOME Maps and the tile problem

Posted Jul 30, 2016 22:03 UTC (Sat) by mcatanzaro (subscriber, #93033) [Link]

Update: https://mail.gnome.org/archives/distributor-list/2016-Jul...

"We have know released GNOME Maps that uses the Mapbox API for getting tiles.
This fixes the issue we had with MapQuest open tiles shutting down. We know have
a stable relationship with Mapbox, and we use a proxy indirection that
will allow us
to repoint our tiles URI without requireing new releases if something
like this would happen in the future."

Fedora updates on the way!

Unfortunately it looks like due to bad timing, Ubuntu wound up removing Maps from the default install in 16.04.1. I wonder if they'll put it back for future releases.

OT: OsmAnd like application for Linux (Debian)?

Posted Jul 31, 2016 18:19 UTC (Sun) by debacle (subscriber, #7114) [Link] (6 responses)

I'm relatively happy with OsmAnd, using offline maps. The main drawback is, that it runs on Android. Is there an application similar to OsmAnd, that runs on a typical Linux desktop such as XFCE or GNOME? Thanks in advance!

(For those who don't know OsmAnd: It allows to download offline maps of countries and regions, one is interested in, has a good address and POI search function, and is relatively flexible about what it shows on the map.)

OT: OsmAnd like application for Linux (Debian)?

Posted Aug 1, 2016 10:25 UTC (Mon) by jezuch (subscriber, #52988) [Link] (4 responses)

How about https://marble.kde.org/

It's a KDE app, but I guess this qualifies as a "typical desktop" ;)

OT: OsmAnd like application for Linux (Debian)?

Posted Aug 4, 2016 14:43 UTC (Thu) by moltonel (guest, #45207) [Link] (1 responses)

Marble also comes in pure Qt flavor nowadays. And as an Andoid app ;)

You could also try digging though http://wiki.openstreetmap.org/wiki/Software/Desktop

OT: OsmAnd like application for Linux (Debian)?

Posted Aug 9, 2016 12:25 UTC (Tue) by debacle (subscriber, #7114) [Link]

I went through this list, but gave up at one point. There are too many entries about dead projects and it is not possible to see whether it has important features like search and offline maps.

OT: OsmAnd like application for Linux (Debian)?

Posted Aug 9, 2016 12:18 UTC (Tue) by debacle (subscriber, #7114) [Link] (1 responses)

Yes, I know marble, but never considered it as an alternative to OsmAnd.
Now I tried again and it seems to be quite good for my purpose!

In Debian 8, there is even a "marble-mobile" package, which contains a version optimised for small screens.
Unfortunately, it does not exist anymore in Debian 9.

So, +1 for marble.

OT: OsmAnd like application for Linux (Debian)?

Posted Feb 10, 2019 20:33 UTC (Sun) by agiantuser (guest, #130357) [Link]

I think the package is now called 'marble-maps':
https://packages.debian.org/search?keywords=marble-maps

OT: OsmAnd like application for Linux (Debian)?

Posted Jun 9, 2019 14:49 UTC (Sun) by maWeujiQo (guest, #132531) [Link]

There is Offroad, a port of Osmand for the Desktop. It works well on my debian 9.9.

https://sourceforge.net/projects/offroadosm/

Deeper Roots

Posted Aug 4, 2016 15:01 UTC (Thu) by Garak (guest, #99377) [Link]

The series of events is frustrating for Maps users, of course, but it is worth remembering that the root of the trouble is MapQuest's sudden reversal of its original pledge to support the open-source community.
Another way to look at it would be to see the root of the trouble as a naive faith that third parties can be blindly depended on. It's always more work to forgo the shortcut of depending on a third party, but there are long term payoffs.


Copyright © 2016, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds