Exemplo n.º 1
0
def from_geo(geo, level):
    """
    Constucts a quadkey representation from geo and level
    geo => (lat, lon)
    If lat or lon are outside of bounds, they will be clipped
    If level is outside of bounds, an AssertionError is raised

    """
    pixel = TileSystem.geo_to_pixel(geo, level)
    tile = TileSystem.pixel_to_tile(pixel)
    key = TileSystem.tile_to_quadkey(tile, level)
    return QuadKey(key)
Exemplo n.º 2
0
def from_geo(geo, level):
    """
    Constucts a quadkey representation from geo and level
    geo => (lat, lon)
    If lat or lon are outside of bounds, they will be clipped
    If level is outside of bounds, an AssertionError is raised

    """
    pixel = TileSystem.geo_to_pixel(geo, level)
    tile = TileSystem.pixel_to_tile(pixel)
    key = TileSystem.tile_to_quadkey(tile, level)
    return QuadKey(key)
Exemplo n.º 3
0
 def testGeoToPixel(self):
     geo = (40., -105.)
     level = 7
     pixel = (6827, 12405)
     self.assertEqual(pixel, TileSystem.geo_to_pixel(geo, level))
Exemplo n.º 4
0
 def testGeoToPixel(self):
     geo = (40., -105.)
     level = 7
     pixel = (6827, 12405)
     self.assertEqual(pixel, TileSystem.geo_to_pixel(geo, level))