OpenStreetMap初探(七)——渲染和地图瓦片之安装Mapnik

http://blog.csdn.net/scy411082514/article/details/7515735

主要的渲染和瓦片工具有这么几个:

渲染 和地图瓦片:
Mapnikmapnik.org[1]
Osmarender (XSLT)svn

trac

Tiles@home distributed renderingsvn-
Kosmos desktop renderingsourcebugs
Tirex mapnik-based tileserver
Staticmaps for requesting bigger map images
...see Rendering
开源就是开源啊,工具很丰富。早闻Mapnik大名,先来看看这个。

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)。

具体的软件安装和下载地址可以根据自己系统的不同,参考这里来安装:

http://wiki.openstreetmap.org/wiki/Mapnik/Installation#For_Microsoft_Windows_.28Windows_2000_and_above.29

我是在winXP环境下安装配置的。

1、首先要下Python 2.7版本,教程给出的连接坏掉了,在网上随便搜了一个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、添加环境变量。

path下添加两个:

;C:\mapnik-2.0.1rc0\lib;C:\Python27;

然后添加一个新的环境变量(如果不存在的话)PYTHONPATH,值为

C:\mapnik-2.0.1rc0\python\2.7\site-packages
4、在命令行中运行python

C:\Python27\python.exe

显示版本号等信息。


命令提示符变为>>>表示在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

2https://github.com/mapnik/mapnik/wiki/WindowsInstallation



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值