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


Python TileStache.splitPathInfo方法代码示例

本文整理汇总了Python中TileStache.splitPathInfo方法的典型用法代码示例。如果您正苦于以下问题:Python TileStache.splitPathInfo方法的具体用法?Python TileStache.splitPathInfo怎么用?Python TileStache.splitPathInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TileStache的用法示例。


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

示例1: tiles

# 需要导入模块: import TileStache [as 别名]
# 或者: from TileStache import splitPathInfo [as 别名]
def tiles(request, service_slug, z, x, y, extension):
    """
    Proxy to tilestache
    {X} - coordinate column.
    {Y} - coordinate row.
    {B} - bounding box.
    {Z} - zoom level.
    {S} - host.
    """
    service = TileService.objects.get(slug=service_slug)
    config = {
        "cache": {"name": "Test"},
        "layers": {}
    }
    config["layers"][service_slug]={
        "provider": {
            'name': 'mapnik',
            "mapfile": service.mapfile
        }
    }
    config = TileStache.Config.buildConfiguration(config)
    path_info = "%s/%s/%s/%s.%s" % (service_slug, z, x, y, extension)
    coord, extension = TileStache.splitPathInfo(path_info)[1:]
    mimetype, content = TileStache.getTile(config.layers[service_slug], coord, extension)
    return HttpResponse(content, mimetype=mimetype)
开发者ID:flyingliang,项目名称:cartoview_arcgis_feature_server,代码行数:27,代码来源:views.py

示例2: tiles

# 需要导入模块: import TileStache [as 别名]
# 或者: from TileStache import splitPathInfo [as 别名]
def tiles(request, layer_name, z, x, y, extension, custom_tile=None):
    """
    Fetch tiles with tilestache.
    """
    metatile = TileStache.Core.Metatile()
    
    if custom_tile:
        config = get_config(custom_tile=custom_tile)
    else:
        config = get_config()
    
    path_info = "%s/%s/%s/%s.%s" % (layer_name, z, x, y, extension)
    coord, extension = TileStache.splitPathInfo(path_info)[1:]
    try:
        tilestacheLayer = config.layers[layer_name]
    except:
        return HttpResponseNotFound()

    status_code, headers, content = tilestacheLayer.getTileResponse(coord, extension)
    mimetype = headers.get('Content-Type')
    if len(content) == 0:
        status_code = 404

    response = HttpResponse(content, content_type=mimetype, status=status_code)
    response['Access-Control-Allow-Origin'] = '*'
    return response
开发者ID:jbants,项目名称:EasyTileServer,代码行数:28,代码来源:views.py

示例3: tilestache

# 需要导入模块: import TileStache [as 别名]
# 或者: from TileStache import splitPathInfo [as 别名]
def tilestache(request, layer_name, z, x, y, extension):
    """
    Proxy to tilestache
    {X} - coordinate column.
    {Y} - coordinate row.
    {B} - bounding box.
    {Z} - zoom level.
    {S} - host.
    """
    config = get_config()
    path_info = "%s/%s/%s/%s.%s" % (layer_name, z, x, y, extension)
    coord, extension = TileStache.splitPathInfo(path_info)[1:]
    mimetype, content = TileStache.getTile(config.layers[layer_name], coord, extension)
    return HttpResponse(content, mimetype=mimetype)
开发者ID:crindt,项目名称:uf,代码行数:16,代码来源:views_painting.py

示例4: application

# 需要导入模块: import TileStache [as 别名]
# 或者: from TileStache import splitPathInfo [as 别名]
def application(environ, start_response):

    config = environ["TILESTACHE_CONFIG"]

    layer, coord, ext = TileStache.splitPathInfo(environ["PATH_INFO"])

    if not config.layers.get(layer, False):
        print >>environ["wsgi.errors"], "[gunistache] unknown layer: " + layer
        status = "404 NOT FOUND"
        data = ""

    else:

        try:
            content_type, data = TileStache.handleRequest(config.layers[layer], coord, ext)
            status = "200 OK"

        except Exception, e:
            print >>environ["wsgi.errors"], "[gunistache] failed to handle request:" + str(e)
            status = "500 SERVER ERROR"
            data = str(e)
开发者ID:straup,项目名称:tilestache-tools,代码行数:23,代码来源:httpony.py

示例5: tilestache_tiles

# 需要导入模块: import TileStache [as 别名]
# 或者: from TileStache import splitPathInfo [as 别名]
def tilestache_tiles(request, layer_name, z, x, y, extension):
    """
    :param request:
    :param layer_name:
    :param z:
    :param x:
    :param y:
    :param extension:
    :return:

    Proxy to tilestache
    {X} - coordinate column.
    {Y} - coordinate row.
    {B} - bounding box.
    {Z} - zoom level.
    {S} - host.
    """

    config = TileStacheConfig.objects.filter(name='default')[0].config
    path_info = "%s/%s/%s/%s.%s" % (layer_name, z, x, y, extension)
    coord, extension = TileStache.splitPathInfo(path_info)[1:]
    mimetype, content = TileStache.getTile(config.layers[layer_name], coord, extension)
    return HttpResponse(content, mimetype=mimetype)
开发者ID:crindt,项目名称:uf,代码行数:25,代码来源:tilestache_views.py


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