当前位置: 首页>>代码示例>>Python>>正文


Python srs.bbox_equals函数代码示例

本文整理汇总了Python中mapproxy.srs.bbox_equals函数的典型用法代码示例。如果您正苦于以下问题:Python bbox_equals函数的具体用法?Python bbox_equals怎么用?Python bbox_equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbox_equals函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_kml

    def test_get_kml(self):
        resp = self.app.get('/kml/wms_cache/0/0/0.kml')
        xml = resp.lxml
        assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')
        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document', namespaces=ns)[0]),
            (-180, -90, 180, 90)
        )
        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay', namespaces=ns)[0]),
            (-180, 0, 0, 90)
        )
        eq_(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay/kml:Icon/kml:href/text()',
                      namespaces=ns),
            ['http://localhost/kml/wms_cache/EPSG900913/1/0/1.jpeg',
             'http://localhost/kml/wms_cache/EPSG900913/1/1/1.jpeg',
             'http://localhost/kml/wms_cache/EPSG900913/1/0/0.jpeg',
             'http://localhost/kml/wms_cache/EPSG900913/1/1/0.jpeg']
        )
        eq_(xml.xpath('/kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href/text()',
                      namespaces=ns),
              ['http://localhost/kml/wms_cache/EPSG900913/1/0/1.kml',
               'http://localhost/kml/wms_cache/EPSG900913/1/1/1.kml',
               'http://localhost/kml/wms_cache/EPSG900913/1/0/0.kml',
               'http://localhost/kml/wms_cache/EPSG900913/1/1/0.kml']
        )

        etag = hashlib.md5(resp.body).hexdigest()
        max_age = base_config().tiles.expires_hours * 60 * 60
        self._check_cache_control_headers(resp, etag, max_age, None)

        resp = self.app.get('/kml/wms_cache/0/0/0.kml',
                            headers={'If-None-Match': etag})
        eq_(resp.status, '304 Not Modified')
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:34,代码来源:test_kml.py

示例2: test_get_kml_nw

    def test_get_kml_nw(self):
        resp = self.app.get('/kml/wms_cache_nw/1/0/0.kml')
        xml = resp.lxml

        assert validate_with_xsd(xml, 'kml/2.2.0/ogckml22.xsd')

        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document', namespaces=ns)[0]),
            (-180, -90, 0, 0)
        )
        assert bbox_equals(
            self._bbox(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay', namespaces=ns)[0]),
            (-180, -66.51326, -90, 0)
        )

        eq_(xml.xpath('/kml:kml/kml:Document/kml:GroundOverlay/kml:Icon/kml:href/text()',
                      namespaces=ns),
            ['http://localhost/kml/wms_cache_nw/EPSG900913/2/0/1.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/1.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/0/0.jpeg',
             'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/0.jpeg']
        )
        eq_(xml.xpath('/kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href/text()',
                      namespaces=ns),
              ['http://localhost/kml/wms_cache_nw/EPSG900913/2/0/1.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/1.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/0/0.kml',
               'http://localhost/kml/wms_cache_nw/EPSG900913/2/1/0.kml']
        )
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:29,代码来源:test_kml.py

示例3: auth

 def auth(service, layers, environ, query_extent, **kw):
     eq_(environ['PATH_INFO'], '/wmts/layer3/GLOBAL_MERCATOR/1/0/0.jpeg')
     eq_(service, 'wmts')
     eq_(len(layers), 1)
     eq_(query_extent[0], 'EPSG:900913')
     assert bbox_equals(query_extent[1], (-20037508.342789244, 0, 0, 20037508.342789244))
     return auth_dict
开发者ID:Anderson0026,项目名称:mapproxy,代码行数:7,代码来源:test_auth.py

示例4: wms_query_eq

def wms_query_eq(expected, actual):
    """
    >>> wms_query_eq('bAR=baz&foo=bizz&bbOX=0,0,100000,100000', 'foO=bizz&BBOx=-.0001,0.01,99999.99,100000.09&bar=baz')
    True
    >>> wms_query_eq('bAR=baz&foo=bizz&bbOX=0,0,100000,100000', 'foO=bizz&BBOx=-.0001,0.01,99999.99,100000.11&bar=baz')
    False
    >>> wms_query_eq('/service?bar=baz&fOO=bizz', 'foo=bizz&bar=baz')
    False
    >>> wms_query_eq('/1/2/3.png', '/1/2/3.png')
    True
    >>> wms_query_eq('/1/2/3.png', '/1/2/0.png')
    False
    """
    from mapproxy.srs import bbox_equals
    if path_from_query(expected) != path_from_query(actual):
        return False

    expected = query_to_dict(expected)
    actual = query_to_dict(actual)

    if 'bbox' in expected and 'bbox' in actual:
        expected = expected.copy()
        expected_bbox = [float(x) for x in expected.pop('bbox').split(',')]
        actual = actual.copy()
        actual_bbox = [float(x) for x in actual.pop('bbox').split(',')]
        if expected != actual:
            return False
        if not bbox_equals(expected_bbox, actual_bbox):
            return False
    else:
        if expected != actual:
            return False

    return True
开发者ID:Geodan,项目名称:mapproxy,代码行数:34,代码来源:http.py

示例5: is_subset_of

    def is_subset_of(self, other):
        """
        Returns ``True`` if every tile in `self` is present in `other`.
        Tile coordinates might differ and `other` may contain more
        tiles (more levels, larger bbox).
        """
        if self.srs != other.srs:
            return False

        if self.tile_size != other.tile_size:
            return False

        # check if all level tiles from self align with (affected)
        # tiles from other
        for self_level, self_level_res in self.resolutions.iteritems():
            level_size = (
                self.grid_sizes[self_level][0] * self.tile_size[0],
                self.grid_sizes[self_level][1] * self.tile_size[1]
            )
            level_bbox = self._tiles_bbox([
                (0, 0, self_level),
                (self.grid_sizes[self_level][0] - 1, self.grid_sizes[self_level][1] - 1, self_level)
            ])

            bbox, level = other.get_affected_bbox_and_level(level_bbox, level_size)
            bbox, grid_size, tiles = other.get_affected_level_tiles(level_bbox, level)

            if other.resolution(level) != self_level_res:
                return False
            if not bbox_equals(bbox, level_bbox):
                return False

        return True
开发者ID:camptocamp,项目名称:mapproxy,代码行数:33,代码来源:grid.py

示例6: test_intersection

    def test_intersection(self):
        assert (DefaultMapExtent().intersection(MapExtent((0, 0, 10, 10), SRS(4326)))
            == MapExtent((0, 0, 10, 10), SRS(4326)))

        assert (MapExtent((0, 0, 10, 10), SRS(4326)).intersection(MapExtent((20, 20, 30, 30), SRS(4326)))
            == None)

        sub = MapExtent((0, 0, 10, 10), SRS(4326)).intersection(MapExtent((-1000, -1000, 100000, 100000), SRS(3857)))
        bbox = SRS(3857).transform_bbox_to(SRS(4326), (0, 0, 100000, 100000), 0)
        assert bbox_equals(bbox, sub.bbox)
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:10,代码来源:test_geom.py

示例7: test_intersection

 def test_intersection(self):
     eq_(self.coverage.intersection((15, 15, 20, 20), SRS(4326)), BBOXCoverage((15, 15, 20, 20), SRS(4326)))
     eq_(self.coverage.intersection((15, 15, 80, 20), SRS(4326)), BBOXCoverage((15, 15, 80, 20), SRS(4326)))
     eq_(self.coverage.intersection((9, 10, 20, 20), SRS(4326)), BBOXCoverage((9, 10, 20, 20), SRS(4326)))
     eq_(self.coverage.intersection((-30, 10, -8, 70), SRS(4326)), BBOXCoverage((-10, 10, -8, 70), SRS(4326)))
     eq_(self.coverage.intersection((-30, 10, -11, 70), SRS(4326)), None)
     eq_(self.coverage.intersection((0, 0, 1000, 1000), SRS(900913)), None)
     assert bbox_equals(
         self.coverage.intersection((0, 0, 1500000, 1500000), SRS(900913)).bbox,
         (0.0, 10, 13.47472926179282, 13.352207626707813),
     )
开发者ID:hpfast,项目名称:mapproxy,代码行数:11,代码来源:test_geom.py

示例8: auth

        def auth(service, layers, query_extent, **kw):
            eq_(service, 'kml')
            eq_(len(layers), 1)
            eq_(query_extent[0], 'EPSG:900913')
            assert bbox_equals(query_extent[1], (-20037508.342789244, -20037508.342789244, 20037508.342789244, 20037508.342789244))

            return {
                'authorized': 'partial',
                'layers': {
                    'layer1': {'tile': True},
                }
            }
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:12,代码来源:test_auth.py

示例9: _no_transformation_needed

 def _no_transformation_needed(self, src_size, src_bbox, dst_size, dst_bbox):
     """
     >>> src_bbox = (-2504688.5428486541, 1252344.271424327,
     ...             -1252344.271424327, 2504688.5428486541)
     >>> dst_bbox = (-2504688.5431999983, 1252344.2704,
     ...             -1252344.2719999983, 2504688.5416000001)
     >>> from mapproxy.srs import SRS
     >>> t = ImageTransformer(SRS(900913), SRS(900913))
     >>> t._no_transformation_needed((256, 256), src_bbox, (256, 256), dst_bbox)
     True
     """
     xres = (dst_bbox[2]-dst_bbox[0])/dst_size[0]
     yres = (dst_bbox[3]-dst_bbox[1])/dst_size[1]
     return (src_size == dst_size and
             self.src_srs == self.dst_srs and
             bbox_equals(src_bbox, dst_bbox, xres/10, yres/10))
开发者ID:olt,项目名称:mapproxy,代码行数:16,代码来源:transform.py

示例10: _image

    def _image(self, query):
        try:
            src_bbox, tile_grid, affected_tile_coords = \
                self.grid.get_affected_tiles(query.bbox, query.size,
                                             req_srs=query.srs)
        except NoTiles:
            raise BlankImage()
        except GridError as ex:
            raise MapBBOXError(ex.args[0])

        num_tiles = tile_grid[0] * tile_grid[1]

        if self.max_tile_limit and num_tiles >= self.max_tile_limit:
            raise MapBBOXError("too many tiles")

        if query.tiled_only:
            if num_tiles > 1:
                raise MapBBOXError("not a single tile")
            bbox = query.bbox
            if not bbox_equals(bbox, src_bbox, abs((bbox[2]-bbox[0])/query.size[0]/10),
                                               abs((bbox[3]-bbox[1])/query.size[1]/10)):
                raise MapBBOXError("query does not align to tile boundaries")

        with self.tile_manager.session():
            tile_collection = self.tile_manager.load_tile_coords(affected_tile_coords, with_metadata=query.tiled_only)

        if tile_collection.empty:
            raise BlankImage()

        if query.tiled_only:
            tile = tile_collection[0].source
            tile.image_opts = self.tile_manager.image_opts
            tile.cacheable = tile_collection[0].cacheable
            return tile

        tile_sources = [tile.source for tile in tile_collection]
        tiled_image = TiledImage(tile_sources, src_bbox=src_bbox, src_srs=self.grid.srs,
                          tile_grid=tile_grid, tile_size=self.grid.tile_size)
        try:
            return tiled_image.transform(query.bbox, query.srs, query.size,
                self.tile_manager.image_opts)
        except ProjError:
            raise MapBBOXError("could not transform query BBOX")
        except IOError as ex:
            from mapproxy.source import SourceError
            raise SourceError("unable to transform image: %s" % ex)
开发者ID:GeoDodo,项目名称:mapproxy,代码行数:46,代码来源:layer.py

示例11: test_bbox

 def test_bbox(self):
     assert bbox_equals(self.extent.bbox, [-10, 10, 80, 80], 0.0001)
开发者ID:ChrisRenton,项目名称:mapproxy,代码行数:2,代码来源:test_geom.py

示例12: test_bbox

 def test_bbox(self):
     assert bbox_equals(self.coverage.bbox, [5.0, 5.0, 10.0, 10.0], 0.0001), self.coverage.bbox
开发者ID:LKajan,项目名称:mapproxy,代码行数:2,代码来源:test_geom.py


注:本文中的mapproxy.srs.bbox_equals函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。