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)
def testGeoToPixel(self): geo = (40., -105.) level = 7 pixel = (6827, 12405) self.assertEqual(pixel, TileSystem.geo_to_pixel(geo, level))