예제 #1
0
파일: __init__.py 프로젝트: minimav/QuadKey
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)
예제 #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)
예제 #3
0
 def testGeoToPixel(self):
     geo = (40., -105.)
     level = 7
     pixel = (6827, 12405)
     self.assertEqual(pixel, TileSystem.geo_to_pixel(geo, level))
예제 #4
0
 def testGeoToPixel(self):
     geo = (40., -105.)
     level = 7
     pixel = (6827, 12405)
     self.assertEqual(pixel, TileSystem.geo_to_pixel(geo, level))