0

出于某种原因,此代码不会打印任何节点、方式或关系,即使它清楚地确实从 OpenStreetMap 下载了分钟更新:

import logging
import osmium
from osmium.replication.server import ReplicationServer

logging.basicConfig(level=logging.DEBUG)

class Handler(osmium.SimpleHandler):
    def __init__(self):
        super(Handler, self).__init__()

    def node(self, n):
        print('n', n.id)

    def way(self, w):
        print('w', w.id)

    def relation(self, r):
        print('r', r.id)

h = Handler()
rs = ReplicationServer('http://planet.openstreetmap.org/replication/minute')
rs.apply_diffs(h, 2112110, 0.4*1024)

结果:

$ python3 osm2rdf.py
DEBUG:pyosmium:Downloaded change 2112110. (86 kB available in download buffer)
DEBUG:pyosmium:Downloaded change 2112111. (36 kB available in download buffer)
DEBUG:pyosmium:Downloaded change 2112112. (4 kB available in download buffer)
DEBUG:pyosmium:Downloaded change 2112113. (-139 kB available in download buffer)

Process finished with exit code 0

请注意,在更改下载后没有打印单个“n”、“w”或“r”。

4

1 回答 1

0

原来这是pyosmium本身的一个错误。关闭。

于 2017-05-25T16:53:49.607 回答