Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(107)  |  Call(95)  |  Derive(0)  |  Import(12)
Internal query for a map with a specific extent, size, srs, etc.

src/m/a/MapProxy-1.6.0/mapproxy/source/wms.py   MapProxy(Download)
from mapproxy.image.merge import concat_legends
from mapproxy.image.transform import ImageTransformer
from mapproxy.layer import MapExtent, DefaultMapExtent, BlankImage, LegendQuery, MapQuery, MapLayer
from mapproxy.source import InfoSource, SourceError, LegendSource
from mapproxy.client.http import HTTPClientError
    def _get_sub_query(self, query, format):
        size, offset, bbox = bbox_position_in_image(query.bbox, query.size, self.extent.bbox_for(query.srs))
        if size[0] == 0 or size[1] == 0:
            raise BlankImage()
        src_query = MapQuery(bbox, size, query.srs, format, dimensions=query.dimensions)
            src_size = int(dst_size[1]*ratio +0.5), dst_size[1]
 
        src_query = MapQuery(src_bbox, src_size, src_srs, format, dimensions=query.dimensions)
 
        if self.coverage and not self.coverage.contains(src_bbox, src_srs):

src/m/a/mapproxy-HEAD/mapproxy/source/wms.py   mapproxy(Download)
from mapproxy.image.merge import concat_legends
from mapproxy.image.transform import ImageTransformer
from mapproxy.layer import MapExtent, DefaultMapExtent, BlankImage, LegendQuery, MapQuery, MapLayer
from mapproxy.source import InfoSource, SourceError, LegendSource
from mapproxy.client.http import HTTPClientError
    def _get_sub_query(self, query, format):
        size, offset, bbox = bbox_position_in_image(query.bbox, query.size, self.extent.bbox_for(query.srs))
        if size[0] == 0 or size[1] == 0:
            raise BlankImage()
        src_query = MapQuery(bbox, size, query.srs, format, dimensions=query.dimensions)
            src_size = int(dst_size[1]*ratio +0.5), dst_size[1]
 
        src_query = MapQuery(src_bbox, src_size, src_srs, format, dimensions=query.dimensions)
 
        if self.coverage and not self.coverage.contains(src_bbox, src_srs):

src/m/a/MapProxy-1.6.0/mapproxy/cache/tile.py   MapProxy(Download)
from mapproxy.image.merge import merge_images
from mapproxy.image.tile import TileSplitter
from mapproxy.layer import MapQuery, BlankImage
from mapproxy.util import async
 
    def _create_single_tile(self, tile):
        tile_bbox = self.grid.tile_bbox(tile.coord)
        query = MapQuery(tile_bbox, self.grid.tile_size, self.grid.srs,
                         self.tile_mgr.request_format, dimensions=self.dimensions)
        with self.tile_mgr.lock(tile):
    def _create_meta_tile(self, meta_tile):
        tile_size = self.grid.tile_size
        query = MapQuery(meta_tile.bbox, meta_tile.size, self.grid.srs, self.tile_mgr.request_format,
            dimensions=self.dimensions)
        main_tile = Tile(meta_tile.main_tile_coord)

src/m/a/mapproxy-HEAD/mapproxy/cache/tile.py   mapproxy(Download)
from mapproxy.image.merge import merge_images
from mapproxy.image.tile import TileSplitter
from mapproxy.layer import MapQuery, BlankImage
from mapproxy.util import async
 
    def _create_single_tile(self, tile):
        tile_bbox = self.grid.tile_bbox(tile.coord)
        query = MapQuery(tile_bbox, self.grid.tile_size, self.grid.srs,
                         self.tile_mgr.request_format, dimensions=self.dimensions)
        with self.tile_mgr.lock(tile):
    def _create_meta_tile(self, meta_tile):
        tile_size = self.grid.tile_size
        query = MapQuery(meta_tile.bbox, meta_tile.size, self.grid.srs, self.tile_mgr.request_format,
            dimensions=self.dimensions)
        main_tile = Tile(meta_tile.main_tile_coord)

src/m/a/mapproxy-HEAD/mapproxy/service/wms.py   mapproxy(Download)
from mapproxy.image.opts import ImageOptions
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async
    def map(self, map_request):
        self.check_map_request(map_request)
 
        params = map_request.params
        query = MapQuery(params.bbox, params.size, SRS(params.srs), params.format)
                    return Response(img.as_buffer(), content_type=img_opts.format.mime_type)
                sub_size, offset, sub_bbox = bbox_position_in_image(params.bbox, params.size, limited_extent.bbox)
                query = MapQuery(sub_bbox, sub_size, SRS(params.srs), params.format)
 
        actual_layers = odict()

src/m/a/MapProxy-1.6.0/mapproxy/service/wms.py   MapProxy(Download)
from mapproxy.image.opts import ImageOptions
from mapproxy.image.message import attribution_image, message_image
from mapproxy.layer import BlankImage, MapQuery, InfoQuery, LegendQuery, MapError, LimitedLayer
from mapproxy.layer import MapBBOXError, merge_layer_extents, merge_layer_res_ranges
from mapproxy.util import async
    def map(self, map_request):
        self.check_map_request(map_request)
 
        params = map_request.params
        query = MapQuery(params.bbox, params.size, SRS(params.srs), params.format)

src/m/a/MapProxy-1.6.0/mapproxy/test/unit/test_cache.py   MapProxy(Download)
from mapproxy.platform.image import Image
 
from mapproxy.layer import (
    CacheMapLayer,
    SRSConditional,
    def test_match(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326)))
        self.source.get_map(MapQuery([0, -90, 180, 90], (256, 256), SRS(4326)))
        eq_(self.client.requested_tiles, [(0, 0, 1), (1, 0, 1)])
    @raises(InvalidSourceQuery)
    def test_wrong_size(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (512, 256), SRS(4326)))
    @raises(InvalidSourceQuery)
    def test_wrong_srs(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (512, 256), SRS(4326)))

src/m/a/mapproxy-HEAD/mapproxy/test/unit/test_cache.py   mapproxy(Download)
from mapproxy.platform.image import Image
 
from mapproxy.layer import (
    CacheMapLayer,
    SRSConditional,
    def test_match(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326)))
        self.source.get_map(MapQuery([0, -90, 180, 90], (256, 256), SRS(4326)))
        eq_(self.client.requested_tiles, [(0, 0, 1), (1, 0, 1)])
    @raises(InvalidSourceQuery)
    def test_wrong_size(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (512, 256), SRS(4326)))
    @raises(InvalidSourceQuery)
    def test_wrong_srs(self):
        self.source.get_map(MapQuery([-180, -90, 0, 90], (512, 256), SRS(4326)))

src/m/a/MapProxy-1.6.0/mapproxy/test/unit/test_tiled_source.py   MapProxy(Download)
from mapproxy.source.tile import TiledSource
from mapproxy.source.error import HTTPSourceErrorHandler
from mapproxy.layer import MapQuery
 
from mapproxy.test.http import mock_httpd
        with mock_httpd(TEST_SERVER_ADDRESS, [({'path': '/1/0/0.png'},
                                                {'body': 'error', 'status': 500, 'headers':{'content-type': 'text/plain'}})]):
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
        with mock_httpd(TEST_SERVER_ADDRESS, [({'path': '/1/0/0.png'},
                                                {'body': 'error', 'status': 500, 'headers':{'content-type': 'text/plain'}})]):
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert not resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
            ({'path': '/1/0/0.png'}, {'body': 'error', 'status': 204, 'headers':{'content-type': 'text/plain'}})]):
 
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert not resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
 
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))

src/m/a/mapproxy-HEAD/mapproxy/test/unit/test_tiled_source.py   mapproxy(Download)
from mapproxy.source.tile import TiledSource
from mapproxy.source.error import HTTPSourceErrorHandler
from mapproxy.layer import MapQuery
 
from mapproxy.test.http import mock_httpd
        with mock_httpd(TEST_SERVER_ADDRESS, [({'path': '/1/0/0.png'},
                                                {'body': 'error', 'status': 500, 'headers':{'content-type': 'text/plain'}})]):
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
        with mock_httpd(TEST_SERVER_ADDRESS, [({'path': '/1/0/0.png'},
                                                {'body': 'error', 'status': 500, 'headers':{'content-type': 'text/plain'}})]):
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert not resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
            ({'path': '/1/0/0.png'}, {'body': 'error', 'status': 204, 'headers':{'content-type': 'text/plain'}})]):
 
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))
            assert not resp.cacheable 
            eq_(resp.as_image().getcolors(), [((256*256), (255, 0, 0))])
 
            resp = self.source.get_map(MapQuery([-180, -90, 0, 90], (256, 256), SRS(4326), format='png'))

  1 | 2  Next