OSM、TileCache 和 Mapnik

发布于 2024-11-09 07:09:44 字数 605 浏览 5 评论 0原文

到目前为止,我已经尝试了两个半星期来获取在服务器上运行的 OpenStreetMap 的本地副本。我已经下载了行星文件并将其导入到名为“osm”的 PostGIS 数据库中。我使用 OSM Mapnik 工具生成 XML 样式表以供 Mapnik 使用。我已经使用 TileLite 来证明 Mapnik 可以从数据库渲染 OSM 图块。这些瓷砖甚至看起来就是我想要的样子。

我现在的问题是我无法让 TileCache 与 Mapnik 一起使用。我安装了一个 MapServer 实例,用于提供 Shapefile 服务。这适用于 TileCache。 TileCache 配置文件中的默认“基本”层也可以工作。请帮助我的 OSM 层:

[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true
bbox=-16697000,8610000,-16667000,8640000
maxResolution=156543.0339/4
levels=18
srs=EPSG:900913

我已经阅读了我能找到的所有最新博客文章、论坛文章和教程。任何帮助将不胜感激。我怀疑我要么错过了什么,要么做了一些愚蠢的事情。

I have been trying for two and a half weeks so far to get a local copy of OpenStreetMap running on a server. I have downloaded the planet file and imported it into a PostGIS database called 'osm'. I have used OSM Mapnik tools to generate an XML stylesheet for Mapnik to use. I have used TileLite to prove that Mapnik can render OSM tiles from the database. The tiles even look the way that I want them to look.

My problem now is that I cannot get TileCache to work with Mapnik. I have a MapServer instance installed that I am using to serve Shapefiles. This works with TileCache. The default 'basic' layer in the TileCache configuration file works as well. Please help with my OSM layer:

[osm]
type=Mapnik
mapfile=/var/maps/bin/mapnik/osm.xml
spherical_mercator=true
bbox=-16697000,8610000,-16667000,8640000
maxResolution=156543.0339/4
levels=18
srs=EPSG:900913

I have read every last blog post, forum post, and tutorial I can find. Any help would be appreciated. I suspect I have either missed something or I am doing something stupid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

執念 2024-11-16 07:09:44

尼克,

我可以理解这里潜在的困难,并且你已经尝试了很多方法。但是,您没有说明您遇到了哪些具体问题,所以我猜这是您的问题:

  • 您正在使用 OpenLayers 来测试图块是否正确生成,但是当您连接到图块时,事情并没有对齐由 TileCache 生成。

那个?如果没有,请提供更多详细信息。

如果这是问题所在,那么您可能需要做的是确保在 OpenLayers 中使用“TMS”图层类型,并将其与 TileCache.cfg 图层参数相匹配。 “TMS”与 OSM 平铺方案非常相似,只是 y 值被翻转。

无论如何,类似这样的东西应该可以工作:

tilecache.cfg

[osm]
type=Mapnik
mapfile=/full/path/to/osm.xml
spherical_mercator=true

OpenLayers Layer

var tms = new OpenLayers.Layer.TMS("TileCache TMS Layer","http://localhost:8000/",
                { serviceVersion: "1.0.0", layername: "osm",  type: "png" });
map.addLayers([tms]);

我从第一次开始工作时从我的一个旧示例中提取了这个:http://mapnik-utils.googlecode.com/svn/example_code/tilecache/openlayers_osm.html

Nik,

I can understand the potential difficulties here and that you've tried a number of things. You did not say what exact problems you ran into however, so I'll guess that this is your problem:

  • You are using OpenLayers to test that the tiles are being produced correctly, but things don't line up when you connect to the tiles generated by TileCache.

That it? If not, please provide a bit more detail.

If that is the problem then likely what you need to do is to make sure to use a "TMS" layer type in OpenLayers and to match that with your TileCache.cfg layer params. "TMS" is very similar to the OSM tile scheme except that the y value is flipped.

Anyway, something like this should work:

tilecache.cfg

[osm]
type=Mapnik
mapfile=/full/path/to/osm.xml
spherical_mercator=true

OpenLayers Layer

var tms = new OpenLayers.Layer.TMS("TileCache TMS Layer","http://localhost:8000/",
                { serviceVersion: "1.0.0", layername: "osm",  type: "png" });
map.addLayers([tms]);

I pulled this from an old example of mine from the first time I got this working: http://mapnik-utils.googlecode.com/svn/example_code/tilecache/openlayers_osm.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文