def _compare_with_osm(self, detected_nodes): comparator = OsmComparator(max_distance=self.max_distance) tag = Tag(key=self.configuration.DETECTION.key, value=self.configuration.DETECTION.value) return comparator.compare(detected_nodes=detected_nodes, tag=tag, bbox=self.bbox)
def __init__(self, word='crosswalk', key='highway', value='crossing', zoom_level=19, compare=True, orthofoto='other'): self.word = word self.tag = Tag(key=key, value=value) self.zoom_level = zoom_level self.barrier = 0.99 self.compare = compare self.orthophoto = orthofoto
def __init__(self, parameters=None): if parameters is None: parameters = dict() self.word = parameters.get('word', 'crosswalk') self.tag = Tag(key=parameters.get('key', 'highway'), value=parameters.get('value', 'crossing')) self.zoom_level = parameters.get('zoom_level', 19) self.barrier = parameters.get('barrier', 0.99) self.compare = parameters.get('compare', True) self.orthophoto = parameters.get('orthophoto', 'other') self.network = parameters.get('network', '') self.labels = parameters.get('labels', '') self.step_width = parameters.get('StepWidth', 0.66) self.follow_streets = parameters.get('follow_street', True) self.bbox_size = float(parameters.get('bbox_size', 2000)) self.timeout = parameters.get('timeout', 5400) self.server = parameters.get('server', '127.0.0.1') self.port = parameters.get('port', 40001) self.password = parameters.get('password', 'crosswalks')
def set_from_config_parser(self, config): self.word = config.get(section='DETECTION', option='Word', fallback='crosswalk') self.tag = Tag(key=config.get(section='DETECTION', option='Key', fallback='highway'), value=config.get(section='DETECTION', option='Value', fallback='crosswalk')) self.zoom_level = config.getint(section='DETECTION', option='ZoomLevel', fallback=19) self.compare = config.getboolean(section='DETECTION', option='Compare', fallback=True) self.orthophoto = config.get(section='DETECTION', option='Orthofoto', fallback='other') self.network = config.get(section='DETECTION', option='Network') self.labels = config.get(section='DETECTION', option='Labels') self.follow_streets = config.getboolean(section='DETECTION', option='FollowStreets', fallback=True) self.barrier = config.getfloat(section='DETECTION', option='DetectionBarrier', fallback=0.99) self.step_width = config.getfloat(section='DETECTION', option='StepWidth', fallback=0.66) self.bbox_size = config.getint(section='REDIS', option='BboxSize', fallback=2000) self.timeout = config.getint(section='REDIS', option='Timeout', fallback=5400) self.port = config.getint(section='REDIS', option='Port', fallback=40001) self.password = config.get(section='REDIS', option='Password', fallback='crosswalks') self.server = config.get(section='REDIS', option='Server', fallback='127.0.0.1')
def main(args): coords = [args.coord[i:i + 2] for i in range(0, len(args.coord), 2)] coords = list(map(lambda c: Node(*c), coords)) bbox = Bbox.from_nodes(coords[0], coords[1]) if args.tags: tags = map(lambda kv: Tag(key=kv[0], value=kv[1]), map(lambda kv: kv.split('=', 1), args.tags.split(','))) walker = OsmObjectWalker(Tile(image_api=WmsApi(), bbox=bbox), tags, square_image_length=100) else: walker = CoordWalker(Tile(image_api=WmsApi(), bbox=bbox), coords, square_image_length=100) tiles = walker.get_tiles() for n, t in enumerate(tiles): centre_node = t.get_centre_node() name = "fetch/{0:02.8}_{1:02.8}.png".format(centre_node.latitude, centre_node.longitude) t.image.save(name, "PNG") print(name)
def _generate_tags(self): tags = [] for category in self.street_categories: tags.append(Tag(key='highway', value=category)) return tags
def roundabout_tag(): return Tag(key='junction', value='roundabout')
def crosswalk_tag(): return Tag(key='highway', value='crossing')
def tag(): key = 'key' value = 'value' return Tag(key=key, value=value)