OpenStreetMap初探(七)——渲染和地图瓦片之安装Mapnik
主要的渲染和瓦片工具有這么幾個:
| 渲染?和地圖瓦片: | ||
| Mapnik | 見mapnik.org | [1] |
| Osmarender?(XSLT) | svn | trac |
| Tiles@home?distributed rendering | svn | - |
| Kosmos?desktop rendering | source | bugs |
| Tirex?mapnik-based tileserver | ||
| Staticmaps?for requesting bigger map images | ||
| ...see?Rendering | ||
Mapnik
Mapnik?is the software we use for?rendering?the main?Slippy Map?layer for OSM, along with other layers such as the "cycle map" layer and "noname" layer. It is also the name given to the main layer, so things get a bit confusing sometimes.
Mapnik is a open source toolkit for rendering maps. It's written in C++ and includes high-level Python bindings. It uses the AGG library and offers anti-aliasing rendering with subpixel accuracy. It can read ESRI shapefiles,PostGIS, TIFF rasters,?.osm?files, any GDAL or OGR supported formats. Packages are available for most Linux distributions and binaries are available for?Mac OS X?and?Windows.
想要多了解的可以看這位仁兄的博文(http://blog.csdn.net/mmtxcp/article/details/5638968)。
具體的軟件安裝和下載地址可以根據(jù)自己系統(tǒng)的不同,參考這里來安裝:
http://wiki.openstreetmap.org/wiki/Mapnik/Installation#For_Microsoft_Windows_.28Windows_2000_and_above.29
我是在winXP環(huán)境下安裝配置的。
1、首先要下Python?2.7版本,教程給出的連接壞掉了,在網(wǎng)上隨便搜了一個http://www.xiazaiba.com/html/2049.html。
? ? ? 安裝在C:\Python27。
2、在這里下載windows下的Mapnik(http://mapnik.org/news/2011/11/29/windows-binaries-progress),下載后是一個壓縮包,解壓后拷貝至c盤根目錄下即可,即C:\mapnik-2.0.1rc0\...
3、添加環(huán)境變量。
path下添加兩個:
;C:\mapnik-2.0.1rc0\lib;C:\Python27;然后添加一個新的環(huán)境變量(如果不存在的話)PYTHONPATH,值為
C:\mapnik-2.0.1rc0\python\2.7\site-packages 4、在命令行中運行python
C:\Python27\python.exe
顯示版本號等信息。
命令提示符變?yōu)?gt;>>表示在python命令下,通過"Ctrl + Z"?或鍵入?"quit()"可退出python。輸入命令:
from mapnik import *沒有報錯。
測試mapnik中提供的例子:
提示pycario不可用,
(注:關于這個提示,我查了一下,大體是目前windows版本還不支持Cairo Rendering這個特性(參看:https://github.com/mapnik/mapnik/wiki/WindowsInstallation),所以不用擔心這條提示)
稍等一下,在demo文件夾下,成功生成一些demo.*文件。
注:
在生成以上幾張圖片后,我這彈了這么一個錯誤。不知道是由于我的電腦的問題還是我的配置問題。由于個人對mapnik實在不怎么感冒,安裝過程也比較糾結,這個問題先放這吧,了解的朋友勞煩賜教,或者告訴我你們有沒有彈類似錯誤我們再進一步討論一下。
1、http://wiki.openstreetmap.org/wiki/Mapnik
2、https://github.com/mapnik/mapnik/wiki/WindowsInstallation
總結
以上是生活随笔為你收集整理的OpenStreetMap初探(七)——渲染和地图瓦片之安装Mapnik的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 关联更新_MySQL UPD
- 下一篇: 支付宝(蚂蚁)开放平台压力测试经验