Skip to content

Commit

Permalink
Merge pull request #75 from metno/issue_72-remove-fastapi-dependency
Browse files Browse the repository at this point in the history
add missing parameters in request
  • Loading branch information
TAlonglong authored Oct 10, 2024
2 parents f72c63a + fc15d93 commit 149abce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions mapgen/modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def handle_request(map_object, full_request):
logger.error(f"status_code=500, failed to handle query parameters: {str(full_request)}, with error: {str(e)}")
raise HTTPError(response_code='500',
response=f"failed to handle query parameters: {str(full_request)}, with error: {str(e)}")
if 'request=getlegendgraphic' in full_request_string.lower():
if not 'sld_version' in full_request_string.lower():
logger.warning("requst is getlegendgraphic, but no sld_version is given. Add SLD_VERSION=1.1.0 to query.")
full_request_string += '&SLD_VERSION=1.1.0'
try:
ows_req.loadParamsFromURL(full_request_string)
except mapscript.MapServerError:
Expand Down Expand Up @@ -815,7 +819,11 @@ def _generate_layer(layer, ds, grid_mapping_cache, netcdf_file, qp, map_obj, pro
try:
style = qp['styles']
except KeyError:
style = qp['style']
try:
style = qp['style']
except KeyError:
logger.warning("Style is not in the request. This is mandatory, but I will set it to raster. This is maybe not what you want.")
style = 'raster'
if (variable.endswith("_vector") or variable.endswith("_vector_from_direction_and_speed")) and style == "":
logger.debug("Empty style. Force wind barbs.")
style = "Wind_barbs"
Expand Down Expand Up @@ -1305,7 +1313,7 @@ def _generate_layer(layer, ds, grid_mapping_cache, netcdf_file, qp, map_obj, pro
_style.maxcolor = mapscript.colorObj(red=255, green=255, blue=255)
_style.minvalue = float(min_val)
_style.maxvalue = float(max_val)
logger.debug(f"After comolrmap min max {min_val} {max_val}")
logger.debug(f"After colormap min max {min_val} {max_val}")

return actual_variable

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ install_requires =
requests>=2.27.1
pyyaml>=5.4.1
jinja2>=3.1.1
uvicorn>=0.17.6
fastapi>=0.75.2

[bdist_wheel]
universal = 0
Expand Down

0 comments on commit 149abce

Please sign in to comment.