示例#1
0
    def doit(self):
        coords_cache = self.osm_cache.coords_cache(mode='r')
        ways_cache = self.osm_cache.ways_cache(mode='r')

        while True:
            relations = self.in_queue.get()
            if relations is None:
                break

            for relation in relations:
                builder = RelationBuilder(relation, ways_cache, coords_cache)
                try:
                    builder.build()
                except IncompletePolygonError, ex:
                    if str(ex):
                        log.debug(ex)
                    continue
                mappings = self.mapper.for_relations(relation.tags)

                inserted = False
                if mappings:
                    inserted = self.insert(mappings, relation.osm_id,
                                           relation.geom, relation.tags)
                if inserted and any(m.skip_inserted_ways for _, ms in mappings
                                    for m in ms):
                    for w in relation.ways:
                        if mappings_intersect(
                                mappings, self.mapper.for_relations(w.tags)):
                            self.inserted_way_queue.put(w.osm_id)
示例#2
0
    def doit(self):
        coords_cache = self.osm_cache.coords_cache(mode='r')
        ways_cache = self.osm_cache.ways_cache(mode='r')

        while True:
            relations = self.in_queue.get()
            if relations is None:
                break

            for relation in relations:
                builder = RelationBuilder(relation, ways_cache, coords_cache)
                try:
                    builder.build()
                except IncompletePolygonError, ex:
                    if str(ex):
                        log.debug(ex)
                    continue
                mappings = self.mapper.for_relations(relation.tags)

                inserted = False
                if mappings:
                    inserted = self.insert(mappings, relation.osm_id, relation.geom, relation.tags)
                if inserted and any(m.skip_inserted_ways for _, ms in mappings for m in ms):
                    for w in relation.ways:
                        if mappings_intersect(mappings, self.mapper.for_relations(w.tags)):
                            self.inserted_way_queue.put(w.osm_id)
示例#3
0
    def doit(self):
        coords_cache = self.osm_cache.coords_cache(mode='r')
        ways_cache = self.osm_cache.ways_cache(mode='r')

        while True:
            relations = self.in_queue.get()
            if relations is None:
                break

            for relation in relations:
                builder = RelationBuilder(relation, ways_cache, coords_cache)
                try:
                    builder.build()
                except IncompletePolygonError, ex:
                    if str(ex):
                        log.debug(ex)
                    continue
                mappings = self.mapper.for_relations(relation.tags)
                if mappings:
                    inserted = self.insert(mappings, relation.osm_id, relation.geom, relation.tags)
                    if inserted and any(getattr(m, 'skip_inserted_ways', False) for _, m in mappings):
                        builder.mark_inserted_ways(self.inserted_way_queue)