首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tilestache Provider() layer对象?能否获取转介URL?

tilestache Provider() layer对象?能否获取转介URL?
EN

Stack Overflow用户
提问于 2012-08-01 10:00:27
回答 1查看 303关注 0票数 1

按照示例here,我尝试使用tilestache创建一个用于显示的层。有没有办法获得引用的url?

我似乎找不到任何关于layer对象是什么的文档。我怀疑这个对象中可能有我可以使用的东西...

代码语言:javascript
复制
class BaselineLayerProvider(object):
    def __init__(self, layer, *args, **kwargs):
        self.layer = layer
        self.provider = ModestMaps.OpenStreetMap.Provider()                

    def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):
        print self.layer
        print dir(self.layer)

        # first, figure out the bounding box of the tile we're rendering
        nw = self.layer.projection.projLocation(ModestMaps.Core.Point(xmin, ymin))
        se = self.layer.projection.projLocation(ModestMaps.Core.Point(xmax, ymax))
        max_lat = max(nw.lat, se.lat)
        min_lat = min(nw.lat, se.lat)
        max_lon = max(nw.lon, se.lon)
        min_lon = min(nw.lon, se.lon)

        bbox = Polygon.from_bbox((min_lon, min_lat, max_lon, max_lat))
        ...
EN

回答 1

Stack Overflow用户

发布于 2012-08-04 01:50:27

Layer对象的描述如下:http://tilestache.org/doc/#layers

我还没有提供获取HTTP referer的方法。如果您需要添加此功能,您可以创建并使用您自己的备用WSGI服务器。我们在Tilestache源代码中有几个这样的例子,比如下面的例子:

https://github.com/migurski/TileStache/blob/master/TileStache/Goodies/ExternalConfigServer.py

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11751628

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档