3

我希望用自托管和免费的东西来取代谷歌地图。搜索了一段时间后,我找到了 OpenMapTiles。我对这些东西很陌生,所以有很多东西我不明白,即:

  • 我不确定我是否有资格获得预渲染图块,我可以从 osm 数据自己生成我的图块吗?
  • 我想有类似谷歌地形图的东西,有等高线,OpenMapTiles 可以吗?
  • 我也有一些 GPS 轨迹,我想在基本地图(OSM 或 Google)上显示,我希望它们可点击(点击打开链接或弹出窗口或类似的东西),这可能吗?
  • OpenMapTiles 服务器运行起来是否繁重?

谢谢

4

1 回答 1

5

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. Display GPS tracks

This is possible as well. What technology you want to use here? Is it web? Then Leaflet is your friend. If it's mobile app, then you can give it a try to VTM: https://github.com/mapsforge/vtm or to Carto.

于 2019-10-01T13:40:46.687 回答