日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

从包中构建瓦片服务器

發布時間:2023/12/9 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 从包中构建瓦片服务器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

SWITCH2OSM

切換到OPENSTREETMAP

豐富的數據

OpenStreetMap數據豐富而詳細,包含與實地人相關的大量數據 - 收集的數據。

功能包括:

  • 道路,鐵路,水路等
  • 餐廳,商店,車站,自動取款機等。
  • 步行和自行車道。
  • 建筑物,校園等

從包中構建瓦片服務器

如果你想建立自己的瓦片服務器,使用軟件包可以節省大量的安裝工作。

這些軟件包與Ubuntu Linux版本12.04 LTS(精確穿山甲)及以上版本配合使用。安裝完成后,您應該使用標準的OSM Mapnik樣式表使用自己的工作tileer,您可以在其中導入OSM數據的提取以進行渲染。

它基于OSM自己的瓦片服務器使用的相同的軟件:

  • mod_tile用于服務
  • renderd作為渲染守護進程
  • mapnik為實際渲染

這些軟件包的主要目的是通過將包裝腳本盡可能多的自動化來簡化安裝。

安裝

需要將以下命令輸入終端進行設置:

如果您沒有安裝add-apt-repository,請將其添加到:

對于Ubuntu 12.04

sudo apt-get install python-software-properties

對于Ubuntu 12.10及更高版本

sudo apt-get安裝軟件屬性常見 添加包含包的存儲庫: sudo add-apt-repository ppa:kakrueger / openstreetmap

更新本地軟件包列表以獲取新的存儲庫:

sudo apt-get更新

安裝軟件包libapache2-mod-tile及其依賴項。在配置過程中,會詢問幾個問題。要確保自動安裝腳本可以工作,您應該保留默認值。但是,在關于數據庫用戶的權限的問題中,您希望在用戶之后添加自己的用戶名,該數據由空格分隔,以便能夠在用戶下導入數據。

sudo apt-get install libapache2-mod-tile

導入地圖數據

下載要渲染的OpenStreetMap數據(完整的行星文件可以在planet.openstreetmap.org上找到,國家提要可以在例如download.geofabrik.de上找到)。例如:

wget http://download.geofabrik.de/europe/ireland-and-northern-ireland-latest.osm.pbf

使用osm2pgsql將數據導入到postgresql數據庫中。osm2pgsql可以使用許多不同的參數,這些參數取決于您可用的硬件和要導入的數據提取的大小。您需要設置的最有可能的是“-C”,“-slim”和“ - 數字處理”。-C指定Mb osm2pgsql將用于緩存數據的數量。所以這取決于你可用的RAM的數量。-slim將完整的osm數據保存在磁盤上,是更新和低內存環境所必需的。-number-processes指定用于導入過程的某些部分的并行進程數。最佳值主要取決于磁盤系統的速度和可用的處理器內核。

osm2pgsql --slim -C 1500 - 數字處理4 ireland-and-northern-ireland.osm.pbf

根據您正在導入的提取物的大小和計算機的性能,對于小型提取物,可能需要幾分鐘的時間才能在較慢的硬件上完成行星的幾分鐘。如果您正在導入完整的行星,強烈建議您設置-C 18000(18 GB的RAM緩存,并隨著OSM數據庫的增長而增加)。如果您沒有足夠的內存量,這可能會導致您的服務器在導入期間進行交換,但在許多情況下,它仍然比為節點緩存使用較小的值更快。但是,您需要確保已配置足夠的交換內存。

如果要導入完整的行星文件,您可能還需要使用-flat-nodes選項。它為某些數據而不是postgis數據庫使用自定義格式文件,使其更有效率,但對區域提取效率較低。在導入期間臨時更改PostgreSQL配置也可能是有意義的。(例如,增加檢查點數量,減少共享緩沖區大小。)

導入時間的大部分以及數據庫的大小都用于創建索引以跟蹤更新。如果您不打算使數據庫連續不間斷地使用“差異文件”,則可能需要使用-drop選項導入數據,該??選項將在導入后刪除“slim-tables”,而不需要渲染并且不創建僅需要支持差異導入的索引。一旦您每1 - 2周更頻繁地更新一次,可能會更有效地每次完成重新導入,而不是使用更新。

mod_tile旨在始終提供最新的圖塊(見下文更新)。由于在更改時重新渲染所有已更改的圖塊通常是不可行的,因此mod_tile會在投放時啟動重新渲染過時的圖塊。這樣的mod_tile需要知道什么時候行星被導入。這是通過更改文件planet-import-complete的時間戳來完成的

觸摸/ var / lib / mod_tile / planet-import-complete

最后,您需要重新啟動渲染守護程序,之后所有應該準備好。

sudo /etc/init.d/renderd重啟

如果一切正常,您應該有一個工作的tileerver,您可以通過訪問http://localhost/osm/slippymap.html查看其結果

如果您沒有在本地主機上打開slippymap.html,并且您只看到粉紅色的圖塊,則需要編輯html頁面,并將localhost替換為“new OpenLayers.Layer.Layer.SMM(”Local Tiles“...”)中正確的服務器名稱,或將其更改為相對URL。

更新

以下命令說明如何使用最新的OSM數據來保持瓷磚服務器的最新版本。

使用上述osm2pgsql導入初始數據庫之后(您將需要在初始導入中使用-slim選項以允許更新),則需要執行以下步驟

安裝滲透

sudo apt-get安裝滲透

授予用戶www數據更新表的權限

sudo /usr/bin/install-postgis-osm-user.sh gis www-data

將滲透復制堆棧初始化為數據導入的數據。選擇行星數據的日期,因為這是差異開始的日期。

sudo -u www-data /usr/bin/openstreetmap-tiles-update-expire 2012-04-21

As the packaged script currently uses an outdated service to determine the correct replication start-point, you will need to manually choose and download the correct state.txt from the?base_url?(see below) which corresponds to slightly before the age of the extract to make sure all modifications are included in your db. This needs to be copied to /var/lib/mod_tile/.osmosis/state.txt

You will next need to update the default configuration of osmosis. In /var/lib/mod_tile/.osmosis/configuration.txt change the?base_url?to
“http://planet.openstreetmap.org/replication/minute/”

Update your tileserver by up to an hour and expire the corresponding rendered tiles

sudo -u www-data /usr/bin/openstreetmap-tiles-update-expire

If your tile server is behind more than an hour you will need to call the openstreetmap-tiles-expire script multiple times. If you want to continuously keep your server up to data, you need to add the openstreetmap-tiles-expire script to your crontab.

Keeping the data up-to-date can be resource intense, in particular because after the import you may already be multiple days behind. Consider changing maxInterval in /var/lib/mod_tile/.osmosis/configuration.txt to 21600 (six hours) till you have caught up. Further, add “–number-processes 2” to the osm2pgsql command in /usr/bin/openstreetmap-tiles-update-expire or a higher number if this is appropriate for your hardware.

The initial install installed pre-processed coastlines, from time to time it may make sense to replace the files with new versions:

wget http://tile.openstreetmap.org/processed_p.tar.bz2

and extract it to

/etc/mapnik-osm-data/world_boundaries/

Troubleshooting

There are a number of things that can go wrong. Here are a few of the common problems and there solutions:

Connection to database failed in osm2pgsql

If you are getting the following error message when importing data with osm2pgsql, you have probably forgotten to add your username in the allowed users section during the configuration. Connection to database Failed: FATAL: Ident authentication failed for user “xyz”

You can fix this in one of two ways:

Either you reconfigure the package, this time including both www-data and your own user name in a space separated list,

sudo dpkg-reconfigure openstreetmap-postgis-db-setup

Or, you manually grant permissions to your user account with the following command:

sudo /usr/bin/install-postgis-osm-user.sh gis xyz

Hardware

Hardware requirements can be quite demanding if you want to render larger areas, but aren’t too bad if you are only interested in smaller regions. For a standard desktop (approximately 4 GB of ram, standard harddisk, dual – quad core CPU) probably an extract size of about 100 – 300 Mb is reasonable (import time of the order of an hour).

If you want to import and render the whole world, you will need a considerably beefier server than a typical desktop. E.g. starting from about 24Gb of RAM upwards. It is also strongly recomend to use an SSD for the database or at least a fast RAID array. The full planet import is currently around about 256GB, so to store all of the DB on an SSD, you will likely need a 512GB SSD. An import that is not updated and uses the –drop option on the otherhand likely still fits on a 256GB SSD. You can also selectively put the most important parts of the database on an SSD and the rest on slower disks. Osm2pgsql supports using separate tablespaces for different parts of the database for this purpose.

FAQ

Where are the various files (DB / Tiles, etc.) ?

  • Style sheets and coastlines are in /etc/mapnik-osm-data
  • Tiles are in /var/lib/mod_tile
  • Renderd configuration in /etc/renderd.conf
  • mod_tile configuration in /etc/apache2/sites-available/tileserver_site
  • Scripts are in /usr/bin
  • Database configuration is in /etc/postgresql/X.X/main (where X.X is the PostgreSQL version, for example 9.1)
  • osm2pgsql configuration and state.txt is in /var/lib/mod_tile/.osmosis

How do I pre-render tiles ?

You can use render_list to pre-render tiles:

Usage: render_list [OPTION] ...-a, --all render all tiles in given zoom level range instead of reading from STDIN-f, --force render tiles even if they seem current-m, --map=MAP render tiles in this map (defaults to 'default')-l, --max-load=LOAD sleep if load is this high (defaults to 5)-s, --socket=SOCKET unix domain socket name for contacting renderd-n, --num-threads=N the number of parallel request threads (default 1)-t, --tile-dir tile cache directory (defaults to '/var/lib/mod_tile')-z, --min-zoom=ZOOM filter input to only render tiles greater or equal to this zoom level (default is 0)-Z, --max-zoom=ZOOM filter input to only render tiles less than or equal to this zoom level (default is 18)

If you are using –all, you can restrict the tile range by adding these options:

-x, --min-x=X minimum X tile coordinate-X, --max-x=X maximum X tile coordinate-y, --min-y=Y minimum Y tile coordinate-Y, --max-y=Y maximum Y tile coordinate

Without –all, send a list of tiles to be rendered from STDIN in the format X Y Z, e.g.

0 0 1 0 1 1 1 0 1 1 1 1

The above would cause all 4 tiles at zoom 1 to be rendered

Note that you have to set –socket=/var/run/renderd/renderd.sock

Acknowledgements

感謝Kai Krueger維護包裝和準備文件。

  • ??英語

搜索

鏈接

?2013 OpenStreetMap和貢獻者,CC-BY-SA。 由皮科摩設計。技術支持WordPress的。

總結

以上是生活随笔為你收集整理的从包中构建瓦片服务器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产精品无码AV无码国产 | 国产精品13p | 亚洲第一大网站 | 成人高潮片免费视频 | 国产无码精品在线播放 | 日韩国产在线播放 | 看av免费毛片手机播放 | h在线观看视频 | 国产在线观看成人 | 成人欧美一区二区三区黑人动态图 | 亚洲图片欧美视频 | 一级性生活毛片 | 黄色91免费版 | 国产www色 | 秋霞网一区二区 | 草逼免费视频 | 亚洲一区二区日韩 | 偷偷操不一样的99 | 污黄视频网站 | 自拍偷拍麻豆 | 欧美色图视频在线 | 自拍偷拍第 | 影音先锋中文字幕在线 | 337p亚洲欧洲色噜噜噜 | 久久久精品久久久久 | 蜜桃成人在线视频 | 久久精品欧美一区二区三区麻豆 | 欧美日韩在线免费观看视频 | 中文字幕第四页 | 国产白浆一区二区 | 天天色天天爱 | 把高贵美妇调教成玩物 | 天堂在线观看视频 | 成人h动漫精品一区二区无码 | 午夜激情影院 | 国偷自产视频一区二区久 | 欧美成人片在线观看 | 日韩在线观看av | 天天激情综合 | 中文字幕在线三区 | 日本黄大片在线观看 | 亚洲系列 | 国产美女久久久久 | 在线成人中文字幕 | 97国产在线视频 | 色网站视频 | 欧美日韩综合在线 | 正在播放木下凛凛xv99 | 宝贝乖h调教灌尿穿环 | 日韩视频一区二区三区 | 美女午夜影院 | 国产精品久久久久久久久久免费 | 中文字幕高清在线免费播放 | 影音先锋欧美资源 | 亚洲人成电影在线播放 | 免费亚洲一区二区 | 欧美大片高清 | 国产乱人伦精品一区二区 | 电影《走路上学》免费 | 国产中文字幕久久 | 久草免费资源 | 日韩精品伦理 | 亚洲高清在线视频 | 国产精品五月天 | 欧美日韩在线一区二区 | 中文乱码人妻一区二区三区视频 | 男女午夜激情 | av网址导航 | 青草视频免费观看 | 黄色资源在线观看 | 成人香蕉视频 | 欧美特黄aaa| 亚洲毛片在线看 | 91精品国产乱码久久 | 国产日韩二区 | 国产激情久久久久久熟女老人av | 正在播放木下凛凛xv99 | 国产一区中文 | 青青草手机在线观看 | 欧美成人高清在线 | 四虎免费久久 | 日本乱轮视频 | 久久久久久人妻一区二区三区 | 一级黄色录像大片 | 久久久久久人妻一区二区三区 | 日本性猛交 | 激情在线观看视频 | 亚洲精品视频免费 | 日本一区二区在线观看视频 | 久久一区二区三区视频 | 亚洲h视频在线观看 | 国产伦精品一区二区 | 国产精品一品二品 | 欢乐谷在线观看免费播放高清 | 亚洲视频一区二区 | 在线观看av国产一区二区 | 日本中文字幕免费观看 | 日韩欧美一区二区三区 | 91av网址|