Exemple #1
0
def get_map():

	# Parse parameters into custom and WMS parameters.
	custom_parameters = []
	custom_parameters_json = request.args.get('PARAMS','[]')
	if custom_parameters_json:
		custom_parameters = json.loads(custom_parameters_json)
	wms_parameters = request.args.items()

	result_field_json = request.args.get('RESULT_FIELD','{}')
	result_field = json.loads(result_field_json)

	filters_json = request.args.get('FILTERS','[]')
	if filters_json: filters = json.loads(filters_json)
	else: filters = []

	map_image = results_services.get_map(wms_parameters=wms_parameters, filters=filters, result_field=result_field)

	# Return the image.
	return Response(map_image, mimetype='image/gif')
def main():
	base_filters = [
			{'field': 'time', 'op': '==', 'value': '2008'},
			{'field': 'tag', 'op': '==', 'value': 'gc30_all'}
			]

	# Test get image.
	wms_parameters = {
			'SERVICE': 'WMS' ,
			'VERSION': '1.1.0', 
			'REQUEST': 'GetMap', 
			'LAYERS': 'data',
			'SRS':'EPSG:4326',
			#'BBOX':'-180.0,-90.0,180.0,90.0',
			'BBOX': '-80,31,-65,45',
			'FORMAT':'image/gif',
			'WIDTH':'640',
			'HEIGHT':'640',
			}
		
	result_field = {
			'field': 'A'
			}
	map_img = results_services.get_map(wms_parameters=wms_parameters.items(), filters=base_filters, result_field=result_field)