def test_with_max_res(self): conf = {'grids': {'grid': {'srs': 'EPSG:4326', 'bbox': [5, 50, 10, 55], 'max_res': 0.0048828125}}} conf = ProxyConfiguration(conf) grid = conf.grids['grid'].tile_grid() assert_almost_equal_bbox([5, 50, 10, 55], grid.bbox, 2) eq_(grid.resolution(0), 0.01953125) eq_(grid.resolution(1), 0.01953125/2)
def test_with_min_res(self): conf = {'grids': {'grid': {'srs': 'EPSG:4326', 'bbox': [5, 50, 10, 55], 'min_res': 0.0390625}}} conf = ProxyConfiguration(conf) grid = conf.grids['grid'].tile_grid() assert_almost_equal_bbox([5, 50, 10, 55], grid.bbox) assert grid.resolution(0) == 0.0390625 assert grid.resolution(1) == 0.01953125
def test_with_bbox_srs(self): conf = { 'grids': { 'grid': { 'srs': 'EPSG:25832', 'bbox': [5, 50, 10, 55], 'bbox_srs': 'EPSG:4326' } } } conf = ProxyConfiguration(conf) grid = conf.grids['grid'].tile_grid() assert_almost_equal_bbox([213372, 5538660, 571666, 6102110], grid.bbox, 1)
def test_with_bbox_srs(self): conf = {'grids': {'grid': {'srs': 'EPSG:25832', 'bbox': [5, 50, 10, 55], 'bbox_srs': 'EPSG:4326'}}} conf = ProxyConfiguration(conf) grid = conf.grids['grid'].tile_grid() assert_almost_equal_bbox([213372, 5538660, 571666, 6102110], grid.bbox, -3)
def test_wms_capabilities(self): req = WMS111CapabilitiesRequest( url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) eq_(resp.content_type, 'application/vnd.ogc.wms_xml') xml = resp.lxml bboxs = xml.xpath('//Layer/Layer[1]/BoundingBox') bboxs = dict((e.attrib['SRS'], e) for e in bboxs) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:31467']), [2750000.0, 5000000.0, 4250000.0, 6500000.0]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:25832']), [0.0, 3500000.0, 1000000.0, 8500000.0]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:3857']), [-20037508.3428, -147730762.670, 20037508.3428, 147730758.195]) assert_almost_equal_bbox(bbox_srs_from_boundingbox(bboxs['EPSG:4326']), [-180.0, -90.0, 180.0, 90.0]) # bboxes clipped to coverage bboxs = xml.xpath('//Layer/Layer[2]/BoundingBox') bboxs = dict((e.attrib['SRS'], e) for e in bboxs) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:31467']), [3213331.57335, 5540436.91132, 3571769.72263, 6104110.432]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:25832']), [213372.048961, 5538660.64621, 571666.447504, 6102110.74547]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:3857']), [556597.453966, 6446275.84102, 1113194.90793, 7361866.11305]) assert_almost_equal_bbox(bbox_srs_from_boundingbox(bboxs['EPSG:4326']), [5.0, 50.0, 10.0, 55.0])
def test_wms_capabilities(self): req = WMS111CapabilitiesRequest(url='/service?').copy_with_request_params(self.common_req) resp = self.app.get(req) eq_(resp.content_type, 'application/vnd.ogc.wms_xml') xml = resp.lxml bboxs = xml.xpath('//Layer/Layer[1]/BoundingBox') bboxs = dict((e.attrib['SRS'], e) for e in bboxs) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:31467']), [2750000.0, 5000000.0, 4250000.0, 6500000.0]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:25832']), [0.0, 3500000.0, 1000000.0, 8500000.0]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:3857']), [-20037508.3428, -147730762.670, 20037508.3428, 147730758.195]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:4326']), [-180.0, -90.0, 180.0, 90.0]) # bboxes clipped to coverage bboxs = xml.xpath('//Layer/Layer[2]/BoundingBox') bboxs = dict((e.attrib['SRS'], e) for e in bboxs) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:31467']), [3213331.57335, 5540436.91132, 3571769.72263, 6104110.432]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:25832']), [213372.048961, 5538660.64621, 571666.447504, 6102110.74547]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:3857']), [556597.453966, 6446275.84102, 1113194.90793, 7361866.11305]) assert_almost_equal_bbox( bbox_srs_from_boundingbox(bboxs['EPSG:4326']), [5.0, 50.0, 10.0, 55.0])