Beispiel #1
0
def test_instantiate():
    bottom = 47.0
    left = 8.0
    top = 48.0
    right = 9.0
    bbox = Bbox(bottom=bottom, left=left, top=top, right=right)

    assert bbox.bottom == bottom
    assert bbox.left == left
    assert bbox.top == top
    assert bbox.right == right
Beispiel #2
0
def test_instantiate_from_string():
    bottom = '47.0'
    left = '8.0'
    top = '48.0'
    right = '9.0'
    bbox = Bbox(bottom=bottom, left=left, top=top, right=right)

    assert bbox.bottom == bottom
    assert bbox.left == left
    assert bbox.top == top
    assert bbox.right == right
Beispiel #3
0
    def _generate_small_bboxes(self):
        m_minx, m_miny = self.mercator.LatLonToMeters(self.big_bbox.bottom, self.big_bbox.left)
        rows = self._calc_rows()
        columns = self._calc_columns()
        side = int(self.configuration.JOB.bboxsize)

        for x in range(0, columns):
            for y in range(0, rows):
                bottom, left = self.mercator.MetersToLatLon(m_minx + (side * x), m_miny + (side * y))
                top, right = self.mercator.MetersToLatLon(m_minx + (side * (x + 1)), m_miny + (side * (y + 1)))
                small_bbox = Bbox(left=left, bottom=bottom, right=right, top=top)
                self.small_bboxes.append(small_bbox)
Beispiel #4
0
def test_manager_standalone(store_path):
    small_bbox = Bbox(left=8.83848086,
                      bottom=47.2218996495,
                      right=8.8388215005,
                      top=47.2220713398)
    manager = Manager(bbox=small_bbox,
                      standalone=True,
                      configuration=Configuration(
                          dict(bbox_size=50, compare=False)))
    manager.run()
    with open(store_path, 'r') as f:
        data = json.load(f)
    assert len(data['nodes']) == 1
Beispiel #5
0
def manager(args, configuration):
    big_bbox = Bbox(left=args.bb_left, bottom=args.bb_bottom, right=args.bb_right, top=args.bb_top)
    try:
        print('Manager has started...')
        manage = Manager(bbox=big_bbox, configuration=configuration, standalone=args.standalone)
        manage.run()
    except ConnectionError:
        print(
            'Failed to connect to redis instance [{ip}:{port}], is it running? Check connection arguments and retry.'.format(
                ip=configuration.REDIS.server,
                port=configuration.REDIS.port))
    finally:
        print('Manager has finished!')
Beispiel #6
0
def test_manager_standalone(store_path, configuration_no_compare):
    small_bbox = Bbox(left=9.351172,
                      bottom=47.098195,
                      right=9.351301,
                      top=47.098480)
    configuration_no_compare.DETECTION.bboxsize = 50
    manager = Manager(bbox=small_bbox,
                      standalone=True,
                      configuration=configuration_no_compare)

    manager.run()
    with open(store_path, 'r') as f:
        data = json.load(f)
    assert len(data['nodes']) == 1
Beispiel #7
0
def test_not_equal(rappi):
    bbox = Bbox()
    assert bbox is not rappi
    assert bbox != rappi
Beispiel #8
0
def test_get_centre_node():
    bbox = Bbox(left=0.0, right=2.0, bottom=0.0, top=2.0)
    simple_tile = Tile(image=None, bbox=bbox)
    centre_node = simple_tile.get_centre_node()
    assert centre_node.latitude == 1.0
    assert centre_node.longitude == 1.0
Beispiel #9
0
def rappi():
    return Bbox(left=8.81372, bottom=47.218788, right=8.852430, top=47.239654)
Beispiel #10
0
def roundabout_bbox():
    return Bbox(left=9.345857, bottom=47.090498, right=9.348325, top=47.092383)
Beispiel #11
0
def zurich_bellevue():
    return Bbox(left=8.5442953706, bottom=47.36628571, right=8.5457748771, top=47.3674659016)
Beispiel #12
0
def rappi():
    return Bbox(left=8.8181022825, bottom=47.2263345016, right=8.8188113747, top=47.2268572692)
Beispiel #13
0
def three_king():
    return Bbox(left=8.529906, bottom=47.364329, right=8.539329, top=47.369052)
Beispiel #14
0
def small_bbox():
    return Bbox(left=8.54279671719532, bottom=47.366177501999516, right=8.543088251618977, top=47.36781249586627)
Beispiel #15
0
 def _generate_bbox(self, t_minx, t_miny, t_maxx, t_maxy):
     bottom, left, _, _ = self._mercator.TileLatLonBounds(t_minx, t_miny, self._zoom_level)
     _, _, top, right = self._mercator.TileLatLonBounds(t_maxx, t_maxy, self._zoom_level)
     return Bbox(left=left, bottom=bottom, right=right, top=top)
Beispiel #16
0
def zurich_bellevue():
    return Bbox(left=8.5448316112, bottom=47.3661604928, right=8.5453673825, top=47.366466604)
Beispiel #17
0
def big_bbox():
    return Bbox(left=8.8, bottom=47.0, right=8.9, top=47.9)
Beispiel #18
0
def small_bbox():
    return Bbox(left=8.83848086, bottom=47.2218996495, right=8.8388215005, top=47.2220713398)
Beispiel #19
0
 def generate_bbox(self, tx, ty):
     bottom, left, top, right = self._mercator.TileLatLonBounds(
         tx, ty, self._zoom_level)
     return Bbox(left=left, bottom=bottom, right=right, top=top)