當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。