Skip to content

Commit

Permalink
fix: conflict in maps.py
Browse files Browse the repository at this point in the history
  • Loading branch information
may_nguyen committed Aug 19, 2022
1 parent c090318 commit 9569721
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions backend/app/app/api/api_v1/endpoints/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@ def generate_style(
"""
Generate style
"""
with open(f"/app/app/assets/styles/{theme}.json") as style_json:
style = json.load(style_json)

if background == "satellite":
satellite = [index for index, layer in enumerate(style["layers"]) if layer["id"] == "satellite"]

if len(satellite) > 0:
style["layers"][satellite[0]]["layout"]["visibility"] = "visible"

return style
if background == "ign":
with open(f"/app/app/assets/styles/ign-{theme}.json") as style_json:
style = json.load(style_json)
return style
else:
with open(f"/app/app/assets/styles/map-{theme}.json") as style_json:
style = json.load(style_json)

if background == "satellite":
satellite = [index for index, layer in enumerate(style["layers"]) if layer["id"] == "satellite"]

if len(satellite) > 0:
style["layers"][satellite[0]]["layout"]["visibility"] = "visible"

return style

@router.get("/geojson", dependencies=[Depends(authorization("maps:get_geojson"))], response_model=FeatureCollection)
def get_geojson(
Expand Down

0 comments on commit 9569721

Please sign in to comment.