按照示例here,我尝试使用tilestache创建一个用于显示的层。有没有办法获得引用的url?
我似乎找不到任何关于layer对象是什么的文档。我怀疑这个对象中可能有我可以使用的东西...
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))
...发布于 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
https://stackoverflow.com/questions/11751628
复制相似问题