Tilecache 无法使用 Mapnik 生成图块

发布于 2024-10-13 15:32:32 字数 1401 浏览 3 评论 0原文

我下载了澳大利亚 OSM 提取内容,并使用 osm2pgsql 将其移至名为 gis 的数据库中。

我已将generate_tiles.py更改为仅生成澳大利亚的图块:

bbox = (-180.0,-90.0, 180.0,90.0)

render_tiles(bbox, mapfile, tile_dir, 0, 5, "World")

minZoom = 10
maxZoom = 16
bbox = (101.1,-6.9,165.5,-45.9)
render_tiles(bbox, mapfile, tile_dir, minZoom, maxZoom)

当我尝试使用以下命令生成图块时: 导出 MAPNIK_MAP_FILE="osm.xml" &&导出 MAPNIK_TILE_DIR="/tmp/tilecache/" && ./z0generate_tiles.py

在 /tmp/tilecache 中使用 png 切片创建了许多目录。这些图块上有州界和国家名称,而且似乎确实有高速公路。 但是..当我导航到该地址时: http://localhost/osm/tilecache-2.11/index.html 我只看到国家和州,但没有标签,也没有街道。我认为这可能是访问 postgis 数据的权限问题。我已经进入 psql 并发出: 将数据库 gis 上的所有权限授予公共

在 /etc/tilecache.cfg 中我有:

[cache]
type=Disk
base=/tmp/tilecache
[osm]
type=Mapnik
mapfile=/home/(my user_name)/bin/mapnik/my_osm.xml
spherical_mercator=true
tms_type=google
metatile=yes
[basic]
type=WMS
url=http://labs.metacarta.com/wms/vmap0
extension=png

看来mapnik 无法与postgis 通信。我已经登录 postgres 并执行: GRANT ALL PRIVILEGES ON DATABASE gis TO PUBLIC

我生成了 my_osm.xml 文件,内容如下:

./generate_xml.py osm.xml my_osm.xml --dbname gis --user (uname) --password (pword) --accept-none

它生成时没有任何错误。

我能接受的就这么多了。通过网络访问时会创建新文件,它们只是没有任何道路信息。 有什么想法吗?

I downloaded the Australian OSM extract and moved it into a database called gis using osm2pgsql.

I have changed generate_tiles.py to only generate tiles for Australia:

bbox = (-180.0,-90.0, 180.0,90.0)

render_tiles(bbox, mapfile, tile_dir, 0, 5, "World")

minZoom = 10
maxZoom = 16
bbox = (101.1,-6.9,165.5,-45.9)
render_tiles(bbox, mapfile, tile_dir, minZoom, maxZoom)

When I attempt to generate tiles with:
export MAPNIK_MAP_FILE="osm.xml" && export MAPNIK_TILE_DIR="/tmp/tilecache/" && ./z0generate_tiles.py

Lots of directories are created in /tmp/tilecache with png tiles. The tiles have state boundaries and country names and there does appear to be highways.
But.. when I navigate to the address:
http://localhost/osm/tilecache-2.11/index.html
I only see countries and states, but no labels and no streets. I figure it is probably a permissions issue with accessing the postgis data. I have gone into psql and issued:
GRANT ALL PRIVILEGES ON DATABASE gis TO PUBLIC

In /etc/tilecache.cfg I have:

[cache]
type=Disk
base=/tmp/tilecache
[osm]
type=Mapnik
mapfile=/home/(my user_name)/bin/mapnik/my_osm.xml
spherical_mercator=true
tms_type=google
metatile=yes
[basic]
type=WMS
url=http://labs.metacarta.com/wms/vmap0
extension=png

It would seem that mapnik is not able to communicate with postgis. I have logged into postgres and executed:
GRANT ALL PRIVILEGES ON DATABASE gis TO PUBLIC

I generated the my_osm.xml file with the following:

./generate_xml.py osm.xml my_osm.xml --dbname gis --user (uname) --password (pword) --accept-none

It generated without any errors.

That's about as far as I can take it. New files are being created when accessed via the web, they just don't have any road information.
Any ideas?

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

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

发布评论

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

评论(1

总以为 2024-10-20 15:32:32

一条评论:

  • generate_tiles.py和tilecache是​​不同的应用程序,彼此不了解。因此,您的tilecache配置只会被tilecache应用程序读取。但是,如果将tilecache与'tms_type=google'一起使用,就像你所做的那样,每个人使用的缓存方案
    程序应该匹配。

要检查丢失的道路的几件事:

  • 有时旧的 geos 库的问题可能会导致缺少 osm2pgsql 导入的数据,因此请确保 plant_osm_line 表中有很多行:

    select count(*) from Planet_osm_line;

  • 此外,请确保您运行的是最新的 Mapnik 版本,至少为 0.7.0,最好为 0.7.1。

  • 尝试使用 nik2img.py 渲染一些地图,并确保 mapnik 现在输出任何可能导致此问题的警告 - 一个常见问题可能是缺少 EPSG:900913 的 proj4 epsg 定义

One comment:

  • generate_tiles.py and tilecache are different applications and don't know about each other. So, your tilecache config will only be read by the tilecache application. But, if tilecache is used with 'tms_type=google', like you have done, the cache schemes used by each
    program should match.

Couple things to check on your missing roads:

  • Sometime problems with old geos libraries can lead to lacking data imported by osm2pgsql, so make sure there are a lot of rows in the plant_osm_line table:

    select count(*) from planet_osm_line;

  • Also, make sure you are running the latest Mapnik version, at least 0.7.0, ideally 0.7.1.

  • Try rendering a few maps with nik2img.py and make sure mapnik does now output any warnings that might be causing this - a common issue can be missing proj4 epsg definitions for EPSG:900913

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