Beispiel #1
0
 def test_meters_to_pixels_4(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(-20037508.342789244, -20037508.342789244)
     try:
         gmp.to_pixels(point, foo=12)
         assert False
     except KeyError as e:
         assert e is not None and type(e) == KeyError
Beispiel #2
0
 def test_meters_to_tile_3(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(7682838.58, 4106808.65)
     try:
         gmp.to_tile(point)
         assert False
     except KeyError as e:
         assert e is not None and type(e) == KeyError
Beispiel #3
0
 def test_lon_lat_to_pixels_1(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(123.4567890, 98.7654321)
     try:
         gmp.to_pixels(point, zoom=18)
         assert False
     except NotImplementedError as e:
         assert e is not None and type(e) == NotImplementedError
Beispiel #4
0
 def test_pixels_to_map_coords_4(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(0, 0)
     try:
         gmp.to_map_coordinates(point, foo=12)
         assert False
     except KeyError as e:
         assert e is not None and type(e) == KeyError
Beispiel #5
0
 def test_pixels_to_raster_3(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(512, 0)
     try:
         gmp.to_raster(point, foo=1)
         assert False
     except KeyError as e:
         assert e is not None and type(e) == KeyError
Beispiel #6
0
 def test_lon_lat_to_raster_1(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(180.0, 90.0)
     try:
         gmp.to_raster(point, zoom=0)
         assert False
     except NotImplementedError as e:
         assert e is not None and type(e) == NotImplementedError
Beispiel #7
0
 def test_lon_lat_to_tile_1(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(-34.123, 78.1234)
     try:
         gmp.to_tile(point)
         assert False
     except NotImplementedError as e:
         assert e is not None and type(e) == NotImplementedError
Beispiel #8
0
 def test_tile_to_map_coordinates_1(self):
     gmp = GlobalMercatorProfile()
     tile = Tile(1, 2)
     try:
         gmp.to_map_coordinates(tile)
         assert False
     except NotImplementedError as e:
         assert e is not None and type(e) == NotImplementedError
Beispiel #9
0
 def test_pixels_to_lon_lat_1(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(1, 2)
     try:
         gmp.to_lon_lat(point)
         assert False
     except NotImplementedError as e:
         assert e is not None and type(e) == NotImplementedError
Beispiel #10
0
 def test_upper_left_tile(self):
     """Test upper left tile method"""
     gmp = GlobalMercatorProfile()
     tile = Tile(0, 1)
     zoom = 1
     result_tile, result_zoom = gmp.upper_left_tile(tile, zoom)
     assert result_tile.tx == tile.tx and \
         result_tile.ty == 0 and \
         result_zoom == zoom
Beispiel #11
0
 def test_init_2(self):
     gmp = GlobalMercatorProfile(tile_size=512)
     assert gmp.tile_size == 512 and \
         gmp.initial_resolution == 78271.51696402048
Beispiel #12
0
 def test_lon_lat_to_map_coords_1(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(180, 85)
     result = gmp.to_map_coordinates(point)
     assert result.mx == 20037508.342789244 and \
         result.my == 19971868.88040853
Beispiel #13
0
 def test_init_1(self):
     gmp = GlobalMercatorProfile()
     assert gmp.tile_size == 256 and \
         gmp.initial_resolution == 156543.03392804097 and \
         gmp.origin_shift == 20037508.342789244
Beispiel #14
0
 def test_pixels_to_raster_2(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(512, 0)
     [x, y] = gmp.to_raster(point, zoom=1)
     assert x == 512 and y == 512
Beispiel #15
0
 def test_lon_lat_to_map_coords_2(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(-148.99, 61.60)
     result = gmp.to_map_coordinates(point)
     assert result.mx == -16585490.933289833 and \
         result.my == 8764912.67945232
Beispiel #16
0
 def test_pixels_to_map_coords_2(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(0, 0)
     result = gmp.to_map_coordinates(point, zoom=0)
     assert result.mx == -20037508.342789244 and \
         result.my == -20037508.342789244
Beispiel #17
0
 def test_pixels_to_raster_1(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(256, 256)
     [x, y] = gmp.to_raster(point, zoom=0)
     assert x == 256 and y == 0
Beispiel #18
0
 def test_meters_to_tile_2(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(7682838.58, 4106808.65)
     result = gmp.to_tile(point, zoom=14)
     assert result.tx == 11332 and result.ty == 9870
Beispiel #19
0
 def test_tile_to_tile_1(self):
     gmp = GlobalMercatorProfile()
     tile = Tile(34, 100)
     result = gmp.to_tile(tile)
     assert result.tx == tile.tx and \
         result.ty == tile.ty
Beispiel #20
0
 def test_pixels_to_tile_2(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(256, 257)
     result = gmp.to_tile(point)
     assert result.tx == 0 and result.ty == 1
Beispiel #21
0
 def test_resolution_1(self):
     gmp = GlobalMercatorProfile()
     result = gmp.resolution(13)
     assert result == 19.109257071294063
Beispiel #22
0
 def test_lon_lat_to_lon_lat_1(self):
     gmp = GlobalMercatorProfile()
     point = LonLatPoint(123.4567890, 98.7654321)
     result = gmp.to_lon_lat(point)
     assert point.lon == result.lon and \
         point.lat == result.lat
Beispiel #23
0
 def test_meters_to_lon_lat_1(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(20037508.342789244, 20037508.342789244)
     result = gmp.to_lon_lat(point)
     assert result.lon == 180.0 and \
         result.lat == 85.0511287798066
Beispiel #24
0
 def test_meters_to_map_coords_1(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(41, 182)
     result = gmp.to_map_coordinates(point)
     assert point.mx == result.mx and \
         point.my == result.my
Beispiel #25
0
 def test_zoom_for_pixel_size_1(self):
     gmp = GlobalMercatorProfile()
     pixel_size = 10
     result = gmp.zoom_for_pixel_size(pixel_size)
     assert result == 13
Beispiel #26
0
 def test_meters_to_pixels_2(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(-20037508.342789244, -20037508.342789244)
     result = gmp.to_pixels(point, zoom=0)
     assert result.x == 0 and result.y == 0
Beispiel #27
0
 def test_meters_to_tile_1(self):
     gmp = GlobalMercatorProfile()
     point = MetersPoint(-20037508.34, 20037508.34)
     result = gmp.to_tile(point, zoom=0)
     assert result.tx == 0 and result.ty == 0
Beispiel #28
0
 def test_pixels_to_pixels_1(self):
     gmp = GlobalMercatorProfile()
     point = PixelsPoint(1, 2)
     result = gmp.to_pixels(point, zoom=12)
     assert point.x == result.x and point.y == result.y
Beispiel #29
0
 def test_tile_size_custom(self):
     """Test a custom tile size"""
     gmp = GlobalMercatorProfile(512)
     assert gmp.tile_size == 512
Beispiel #30
0
 def test_tile_from_pixels(self):
     """Test making a tile from pixels"""
     gmp = GlobalMercatorProfile()
     zoom = 1
     point = MetersPoint(-20037508.3204, -20037508.3204)
     x, y = gmp.pixels_from_units(point, zoom)