3

I'm looking to replace Google Maps by something self-hosted and free. After searching for some time I found OpenMapTiles. I'm very new to this stuff, so there are many things I don't understand, namely:

  • I'm not sure I qualify for pre-rendered tiles, can I generate my tiles myself from osm data?
  • I would like to have something like google terrain map, with contour lines, is that possible with OpenMapTiles?
  • I also have some GPS tracks that I would like to show like overlay over base maps (OSM or Google), and I want them clickable (clicking open a link or popup or something like that), is that possible?
  • Is OpenMapTiles server heavy to run?

Thanks

xarlymg89
  • 2,552
  • 2
  • 27
  • 41
st.
  • 593
  • 1
  • 5
  • 12

1 Answers1

7

That's totally possible, I've done it myself. However, it takes a while to do everything.

1. Generate MBTiles

First of all, I'd suggest you start taking a look in the Github repo of OpenMapTiles: https://github.com/openmaptiles/openmaptiles

To generate an MBTiles file, for a country is quite manageable to do in your own computer. And basically you can do so by executing the main script with the name of the country as a parameter. Like this:

./quickstart.sh portugal

After the script creates a Docker machine, downloads the OpenStreetMap data for the country, processes it, and generates the MBTiles file, then you'll be done.

For me, with an average computer, for countries like Spain or Portugal, it takes about 4-12 hours to do so. But it really depends on the country. Norway takes forever (about 4 days), I believe due to its very long coastline.

If you want an MBTiles file that will work for the whole planet, then you need a more powerful computer, that specially has a big SSD and lots of RAM. Between 32 and 64 GB of RAM and 250-300 GB of SSD.

2. Set up a tile server

After that, you can use this project https://github.com/urbica/tessella to run your own tile server to be consumed form a website or mobile app.

The resources of the server will depend on the size of the MBTiles file you want to use in the server.

3. Enable contour lines

This is possible too, but a bit more trickier. I'd suggest you use Maptiler as a service for this.

Whenever I achieve this matter, I'll go back to you with the information.

If the tiles you generate don't contain the contour / elevation data, then styles won't help. The tiles from OpenMapTiles do not have the contours inside.

4. Web and mobile libraries (to display GPS tracks, waypoints, etc)

This is possible as well. What technology you want to use here?

For web apps:

For mobile apps:

xarlymg89
  • 2,552
  • 2
  • 27
  • 41
  • thank you. For pt.1&2 I found a tutorial: https://golb.hplar.ch/2018/07/self-hosted-tile-server.html I started to follow it but my virtual box linux hadn't enough disk. But I understand now how it works. For pt.3, I'm not sure how, but I think it should be possible to specify the style file from OpenTopoMap? For pt.4, what I want is to generate tiles with all gps tracks data. Suppose you have like 300 tracks, I would like to generate mbtiles from those, then I can use leaflet or something to overlay it over another map. – st. Oct 01 '19 at 17:57
  • If the tiles you generate don't contain the contour / elevation data, then styles won't help. The tiles from OpenMapTiles do not have the contours inside. – xarlymg89 Oct 02 '19 at 06:28
  • Adding the tracks inside the tiles is a possibility, althoug I'd suggest you create a GeoJson for it with all the routes. – xarlymg89 Oct 02 '19 at 06:29
  • I think I'm confusing stuff, sorry. By "style" i mean the rules used to transform osm data into mbtiles. There are contour line tiles you can download from their site, I would like to combine that with base map to have someting like opentopomap. For showing routes, i have them as different kml files, one file for one route. I can show that no problem with leaflet for eample, but those are not standard tiles. I don't know GeoJson, is that something that support streaming of tiles too? – st. Oct 02 '19 at 10:16
  • there is an example of what i want: https://s.geo.admin.ch/84b7c88c36 You can see those red and yellow hiking routes over the base map that can be switched on and off and also can be clicked (at least some of them) – st. Oct 02 '19 at 12:25
  • If you pay to OpenMapTiles, then yes, you can download the contour data. Otherwise is not possible. – xarlymg89 Oct 02 '19 at 13:28
  • I meant schema, not style, sorry. Styles are later used to draw or paint the vector data in websites or mobile apps. – xarlymg89 Oct 02 '19 at 13:33
  • Those red and yellow lines are most likely en GeoJSON or TopoJSON format. You would have to transform your KML into that. Shouldn't be that complicated. – xarlymg89 Oct 02 '19 at 13:34
  • Those red and yellow lines, they are in PNG format lol. Use F12 – st. Oct 02 '19 at 18:18
  • Anyway, you can directly load KML or GPX using Leaflet, or generate a GeoJSON / TopoJSON file with all of them inside. Or create vector tiles with all of them in a different layer and style it accordingly. There are many ways of doing this :) It just depends on your time and resources availability and your desired results. – xarlymg89 Oct 03 '19 at 10:50
  • I got the tessella server up and running, but I don't know how to get anything other than /index.json. Index.json references a URL scheme: /{z}/{x}/{y}.pbf which I assume stands for zoom, lat and lng, but it just returns 404 regardless of the coordinates (I checked the bounds). How do you use this once it's up? – Lawrence I. Siden Nov 04 '19 at 22:10
  • @LawrenceI.Siden I guess it's quite likely you accidentally messed up with the paths so tessella isn't really reading the mbtiles properly. Are you using tessella with Docker or directly? – xarlymg89 Nov 05 '19 at 08:19
  • @xarlymg89, Directly. I found the problem - I needed to translate lat/lng into x/y coordinates for tiles. tessalla returns 404 if the coordinates are out of range (as you might expect) so it took me a while to figure out what the problem was. – Lawrence I. Siden Nov 05 '19 at 15:59
  • @LawrenceI.Siden ups, my bad. You mentioned this in your message, but I didn't really read that part. That's correct, it's not lat and lng. Glad you found that out :) – xarlymg89 Nov 05 '19 at 19:45