惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Spread Privacy
Spread Privacy
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
AI
AI
N
News | PayPal Newsroom
A
Arctic Wolf
NISL@THU
NISL@THU
W
WeLiveSecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
P
Palo Alto Networks Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
L
Lohrmann on Cybersecurity
Last Week in AI
Last Week in AI
T
Threatpost
The Last Watchdog
The Last Watchdog
博客园_首页
C
Cybersecurity and Infrastructure Security Agency CISA
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
aimingoo的专栏
aimingoo的专栏
S
Security Affairs
P
Privacy & Cybersecurity Law Blog
B
Blog RSS Feed
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
雷峰网
雷峰网
T
Tenable Blog
Schneier on Security
Schneier on Security
H
Heimdal Security Blog
V2EX - 技术
V2EX - 技术
V
V2EX
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
Latest news
Latest news
Help Net Security
Help Net Security
Jina AI
Jina AI
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
V
Vulnerabilities – Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org

博客园 - 独孤求败

移动端跨平台框架及资料 清理数据库订阅表 Raphael JS 矢量客户端开源框架 基于SqlServer 2008 Service Broker的分布式应用 Telerik在mvc中的环境搭建 openscales2.2 style定义 openscales2.2 的初始缩放等级 openscales2.2的画点、线、多边形 Vs2010 FLex的集成开发 Openscales2.2 mapserver 开发demo PostGis Mapserver Openscales 环境搭建 mvc3无智能提示的解决方法 oracle数据库管理员创建用户的job 隐藏后台执行的dos窗口 iframe 加载完成但是ie进度条还在加载的解决办法 安卓模拟器的安装和使用 WCF错误及处理记录 - 独孤求败 - 博客园 .net学习资料链接收集整理 B树、B-树、B+树、B*树
openscales2.2 tilecache2.11图片缓存
独孤求败 · 2013-04-02 · via 博客园 - 独孤求败

为了加快地图的显示速度,通过tilecache将瓦片保存为图片,下次直接就可以加载图片。

tilecache的环境搭建:

    下载地址:http://tilecache.org/(最新的版本为2.11)。

    下载解压完之后,将目录tilecache-2.11copy到之前搭建好的mapserver环境下面(For Example:C:\ms4w\apps)。

Python2.5下载:

    下载地址:http://www.python.org/getit/(可下载最新的版本,没有测试),下载完成之后一路安装就ok了。

    由于要使用Apache HTTP Server来启用Python,因此需要为Apache增加一个Module——mod_python(example:mod_python-3.3.1.win32-py2.5-Apache2.2)注意pytho和appache的版本和你安装的要一致。

  下载地址:http://www.modpython.org/。下载完成之后直接进行安装,安装好之后,打开Apache的conf\ httpd.conf文件,在#LoadModule后添加

LoadModule python_module modules/mod_python.so;

 在Apache的httpd.conf文件中增加如下配置:

Alias /tilecache/ "C:/ms4w/apps/tilecache-2.11/"
<Directory "C:/ms4w/apps/tilecache-2.11/">
    AddHandler mod_python .py 
    AddHandler python-program .py
    PythonHandler TileCache.Service 
    PythonOption TileCacheConfig C:/ms4w/apps/tilecache-2.11/tilecache.cfg
    PythonDebug On  
    PythonPath "['C:/ms4w/apps/tilecache-2.11/']+sys.path"  
    Allow from all
</Directory>

接下来进行tilecache的配置:

    在tilecache目录下面找到tilecache.cgi文件,将第一行修改为:#!C:/Python25/python.exe -u(也就是python的安装路径),修改之后将该文件重命名为tilecache.py。

    在tilecache目录下面找到tilecache.cfg文件,找到“[cache] type=Disk base=”(缓存图片保存路径),将base设置为你放置图片的目录。

    增加你的图层:

[bound]
type=WMS
url=http://localhost:8085/cgi-bin/mapserv.exe?MAP=D:/tmp/GisDemo/GisDemo/Content/map/OpenscalesDemo.map
layers=bound,road
extension=png

    至此位置tilecache的配置到此位置。
 环境变量和注册表的配置:

    增加C:\Python25在path中。

   在HKEY_LOCAL_MACHINE节点下(PythonPath的节点增加C:\ms4w\apps\tilecache-2.11\),当然如果地图没有问题就不用修改注册表。

      

经过以上的步骤,重启一下apache。

在浏览器中输入如下地址:

http://localhost:8085/tilecache/tilecache.py?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256

出现如图的效果,说明环境搭建成功(当然也可以测试自己建议的图层,本文例子中的bound):

tilecache环境搭建好之后,我们在openscales中修改一下引用的地址即可,参见如下代码:

<os:WMSC name="bound"
          url="http://localhost:8085/tilecache/tilecache.py"
          layers="bound"
          format="image/jpeg"
          transparent ="false"
          resolutions="0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 0.0006866455078125, 0.00034332275390625, 0.000171661376953125, 8.58306884765625e-005, 4.291534423828125e-005, 2.1457672119140625e-005, 1.0728836059570313e-005, 5.3644180297851563e-006, 2.6822090148925781e-006, 1.3411045074462891e-006"
          />


至此,我们在openscales中可以使用缓存的瓦片数据,提高地图加载的速度。