예제 #1
0
def generateCache(filename='berlin.osm.pbf'):
    cache = OSMCache('.')
    coords_queue = JoinableQueue(512)
    coords_writer = CacheWriterProcess(coords_queue,
                                       cache.coords_cache,
                                       None,
                                       marshaled_data=True)
    coords_writer.start()

    parser = OSMParser(coords_callback=coords_queue.put)

    parser.parse(filename)

    coords_queue.put(None)
    coords_writer.join()
    return cache
예제 #2
0
def main(filename, output):
    #cache = generateCache(filename)
    cache = OSMCache('.')
    coords_queue = JoinableQueue(512)
    coords_writer = CacheWriterProcess(coords_queue,
                                       cache.coords_cache,
                                       None,
                                       marshaled_data=True)
    coords_writer.start()

    handler = Handler(cache, output)
    parser = OSMParser(coords_callback=coords_queue.put,
                       nodes_callback=handler.nodes_callback,
                       ways_callback=handler.ways_callback)
    parser.parse(filename)

    coords_queue.put(None)
    coords_writer.join()