def wms_impl(): nocase_args = lower_get_args() service = nocase_args.get("service", "").upper() operation = nocase_args.get("request", "").upper() try: if service == "WMS": # WMS operation Map if not operation: raise WMSException("No operation specified", locator="Request parameter") elif operation == "GETCAPABILITIES": return get_capabilities(nocase_args) elif operation == "GETMAP": return get_map(nocase_args) elif operation == "GETFEATUREINFO": return feature_info(nocase_args) else: raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED, "Request parameter") else: raise WMSException("Invalid service", locator="Service parameter") except WMSException as e: return wms_exception(e) except Exception as e: tb = sys.exc_info()[2] wms_e = WMSException("Unexpected server error: %s" % str(e), http_response=500) return wms_exception(wms_e, traceback=traceback.extract_tb(tb))
def test_map_zoomedout(cube, release_cube_dummy, mocker, id, test_args, expect_png): app = flask.Flask( "test", root_path=os.path.dirname(os.path.realpath(__file__) + "/../..")) with app.test_request_context('/?GetMap'): args = {} resp = get_map(test_args) with open(expect_png) as png: resp == png
def test_map_zoomedin(cube, release_cube_dummy, mocker, id, test_args, expect_png): app = flask.Flask( "test", root_path="/Users/robbie/dev/datacube-wms/datacube_wms") with app.test_request_context('/?GetMap'): args = {} resp = get_map(test_args) with open(expect_png) as png: resp == png
def get_tile(args): wms_args = wmts_args_to_wms(args) try: return get_map(wms_args) except WMSException as wmse: first_error = wmse.errors[0] e = WMTSException(first_error["msg"], code=first_error["code"], locator=first_error["locator"], http_response=wmse.http_response) for error in wmse.errors[1:]: e.add_error(error["msg"], code=error["code"], locator=error["locator"]) raise e
def handle_wms(nocase_args): operation = nocase_args.get("request", "").upper() # WMS operation Map if not operation: raise WMSException("No operation specified", locator="Request parameter") elif operation == "GETCAPABILITIES": return get_capabilities(nocase_args) elif operation == "GETMAP": return get_map(nocase_args) elif operation == "GETFEATUREINFO": return feature_info(nocase_args) else: raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED, "Request parameter")
def wms_impl(): nocase_args = lower_get_args() operation = nocase_args.get("request") try: if not operation: raise WMSException("No operation specified", locator="Request parameter") elif operation == "GetCapabilities": return get_capabilities(nocase_args) elif operation == "GetMap": return get_map(nocase_args) elif operation == "GetFeatureInfo": return feature_info(nocase_args) else: raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED, "Request parameter") except WMSException as e: return wms_exception(e) except Exception as e: tb = sys.exc_info()[2] wms_e = WMSException("Unexpected server error: %s" % str(e), http_response=500) return wms_exception(wms_e, traceback=traceback.extract_tb(tb))
def handle_wms(nocase_args): operation = nocase_args.get("request", "").upper() # WMS operation Map if not operation: raise WMSException("No operation specified", locator="Request parameter") elif operation == "GETCAPABILITIES": return get_capabilities(nocase_args) elif operation == "GETMAP": return get_map(nocase_args) elif operation == "GETFEATUREINFO": return feature_info(nocase_args) elif operation == "GETLEGENDGRAPHIC": response = legend_graphic(nocase_args) if response is None: raise WMSException( "Operation GetLegendGraphic not supported for this product and style", WMSException.OPERATION_NOT_SUPPORTED, "Request parameter") else: return response else: raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED, "Request parameter")