當前位置: 首頁>>代碼示例>>Python>>正文


Python ShapeMetadata.index方法代碼示例

本文整理匯總了Python中plenario.models.ShapeMetadata.index方法的典型用法代碼示例。如果您正苦於以下問題:Python ShapeMetadata.index方法的具體用法?Python ShapeMetadata.index怎麽用?Python ShapeMetadata.index使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在plenario.models.ShapeMetadata的用法示例。


在下文中一共展示了ShapeMetadata.index方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_all_shape_datasets

# 需要導入模塊: from plenario.models import ShapeMetadata [as 別名]
# 或者: from plenario.models.ShapeMetadata import index [as 別名]
def get_all_shape_datasets():
    """
    Fetches metadata for every shape dataset in meta_shape
    """
    try:
        response_skeleton = {
                'meta': {
                    'status': 'ok',
                    'message': '',
                },
                'objects': []
            }

        public_listing = ShapeMetadata.index(caller_session=session)
        response_skeleton['objects'] = public_listing
        status_code = 200

    except Exception as e:
        print e.message
        response_skeleton = {
            'meta': {
                'status': 'error',
                'message': '',
            }
        }
        status_code = 500

    resp = make_response(json.dumps(response_skeleton), status_code)
    resp.headers['Content-Type'] = 'application/json'
    return resp
開發者ID:hectron,項目名稱:plenario,代碼行數:32,代碼來源:api.py

示例2: get_all_shape_datasets

# 需要導入模塊: from plenario.models import ShapeMetadata [as 別名]
# 或者: from plenario.models.ShapeMetadata import index [as 別名]
def get_all_shape_datasets():
    """
    Fetches metadata for every shape dataset in meta_shape
    """
    try:
        response_skeleton = {
                'meta': {
                    'status': 'ok',
                    'message': '',
                },
                'objects': []
            }

        geom = request.args.get('location_geom__within')
        if geom:
            geom = make_sql_ready_geom(geom)

        public_listing = ShapeMetadata.index(geom)
        response_skeleton['objects'] = public_listing
        status_code = 200

    except Exception as e:
        print e.message
        response_skeleton = {
            'meta': {
                'status': 'error',
                'message': '',
            }
        }
        status_code = 500

    resp = make_response(json.dumps(response_skeleton), status_code)
    resp.headers['Content-Type'] = 'application/json'
    return resp
開發者ID:carhart,項目名稱:plenario,代碼行數:36,代碼來源:shape.py

示例3: get_all_shape_datasets

# 需要導入模塊: from plenario.models import ShapeMetadata [as 別名]
# 或者: from plenario.models.ShapeMetadata import index [as 別名]
def get_all_shape_datasets():
    """Fetches metadata for every shape dataset in meta_shape.
    """
    try:
        response_skeleton = {
            'meta': {
                'status': 'ok',
                'message': '',
            },
            'objects': []
        }

        geom = request.args.get('location_geom__within')
        simple_bbox = request.args.get('simple_bbox')

        if geom:
            geom = make_fragment_str(
                extract_first_geometry_fragment(geom)
            )

        if simple_bbox:
            public_listing = ShapeMetadata.simple_index(geom)
        else:
            public_listing = ShapeMetadata.index(geom)
        response_skeleton['objects'] = public_listing
        status_code = 200

    except Exception as e:
        response_skeleton = {
            'meta': {
                'status': 'error',
                'message': str(e),
            }
        }
        status_code = 500

    resp = make_response(json.dumps(response_skeleton, default=str), status_code)
    resp.headers['Content-Type'] = 'application/json'
    return resp
開發者ID:UrbanCCD-UChicago,項目名稱:plenario,代碼行數:41,代碼來源:shape.py


注:本文中的plenario.models.ShapeMetadata.index方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。