本文整理汇总了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
示例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
示例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