def bounds_tile(self, zoom):
     """
      * Returns the tile boundaries in the form [(x_min, y_min), (x_max, y_max)] where both values are tuples
     :param zoom: 
     :param manual_bounds: 
     :return:         """
     bounds = self.bounds_longlat()
     scheme = self.scheme()
     return get_tile_bounds(zoom=zoom, bounds=bounds, scheme=scheme)
 def bounds_tile(self, zoom):
     bounds = self._get_metadata_value("bounds")
     if bounds:
         bounds = bounds\
             .replace(" ", "")\
             .replace("[", "")\
             .replace("]", "")\
             .split(",")
         bounds = map(lambda s: float(s), bounds)
     scheme = self.scheme()
     return get_tile_bounds(zoom=zoom, bounds=bounds, scheme=scheme)
示例#3
0
    def _get_visible_extent_as_tile_bounds(self, scheme, zoom):
        e = self.iface.mapCanvas().extent().asWktCoordinates().split(", ")
        new_extent = map(lambda x: map(float, x.split(" ")), e)
        min_extent = new_extent[0]
        max_extent = new_extent[1]

        min_proj = epsg3857_to_wgs84_lonlat(min_extent[0], min_extent[1])
        max_proj = epsg3857_to_wgs84_lonlat(max_extent[0], max_extent[1])

        bounds = []
        bounds.extend(min_proj)
        bounds.extend(max_proj)
        tile_bounds = get_tile_bounds(zoom,
                                      bounds=bounds,
                                      scheme=scheme,
                                      source_crs="EPSG:4326")

        debug("Current extent: {}", tile_bounds)
        return tile_bounds
示例#4
0
def test_manual_bounds_tms():
    # boundary for mbtiles zurich 4 tiles in bottom left corner
    b = [8.268328, 47.222658, 8.298712, 47.243988]
    t = get_tile_bounds(14, b, scheme="tms")
    assert t[0] == (8568, 10637)
    assert t[1] == (8569, 10636)
示例#5
0
def test_manual_bounds_xyz():
    # boundary for mbtiles zurich 4 tiles in bottom left corner
    b = [8.268328, 47.222658, 8.298712, 47.243988]
    t = get_tile_bounds(14, b, scheme="xyz")
    assert t[0] == (8568, 5746)
    assert t[1] == (8569, 5747)