Skip to content

Commit

Permalink
Minor fixes (#199)
Browse files Browse the repository at this point in the history
* Fix sprites (Bright)

* Add support for coalesce expression

* Fix missing building in Streets

* Revert Fix missing building in Streets
  • Loading branch information
lazaa32 authored Jan 15, 2025
1 parent 028b95f commit f307af7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion gl2qgis/gl2qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def parse_fill_layer(json_layer, context):
sprite_size = QSize()
sprite_property = ""
sprite_size_property = ""
sprite = core_converter.retrieveSpriteAsBase64(json_fill_patern, context, sprite_size, sprite_property, sprite_size_property)
sprite = core_converter.retrieveSpriteAsBase64(json_fill_patern, context)

if sprite:
# when fill-pattern exists, set and insert QgsRasterFillSymbolLayer
Expand Down Expand Up @@ -1161,6 +1161,12 @@ def parse_case(json_list: list, context: QgsMapBoxGlStyleConversionContext):
return case_str


def parse_coalesce(json_list: list, context: QgsMapBoxGlStyleConversionContext):
coalesce_items = list(map(parse_expression, json_list[1:], repeat(context)))
coalesce_str = f"COALESCE({','.join(coalesce_items)})"
return coalesce_str


def parse_array_stops(stops: list, multiplier: (int, float)):
if len(stops) < 2:
return
Expand Down Expand Up @@ -1494,6 +1500,8 @@ def parse_expression(json_expr, context):
return parse_concat(json_expr, context)
elif op == "case":
return parse_case(json_expr, context)
elif op == "coalesce":
return parse_coalesce(json_expr, context)
else:
context.pushWarning(f"{context.layerId()}: Skipping unsupported expression.")
return
Expand Down

0 comments on commit f307af7

Please sign in to comment.