Following the example here, I'm attempting to create a layer for display using tilestache. Is there a way to get the referring url?
I can't seem to find any documentation of what the layer
object is.
I suspect there may be something in this object that I can use...
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))
...
The Layer object is described here: http://tilestache.org/doc/#layers
I haven't provided a way to get the HTTP referer. If you need to add this feature, you can create and use an alternate WSGI server of your own. We have a few examples of this in the Tilestache source, such as this example:
https://github.com/migurski/TileStache/blob/master/TileStache/Goodies/ExternalConfigServer.py