当前位置: 首页>>代码示例>>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;未经允许,请勿转载。