Skip to content

Commit a4c5e5e

Browse files
committed
fix: Fix !in and $type expressions conversion from maplibre
1 parent 8380639 commit a4c5e5e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

galileo-maplibre/src/style/expression.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -746,11 +746,7 @@ impl MlExpr {
746746
fn get_prop(prop: &MlExpr) -> Option<Expr> {
747747
if let MlExpr::Literal(Value::String(property_name)) = prop {
748748
if property_name == "$type" {
749-
// TODO: this is supposed to check geometry type of the layer,
750-
// but in Galileo this is done by the symbol. Need to check if
751-
// it is possible in Maplibre to draw a layer with wrong geometry
752-
// type. If so, do we need to do anything for it?
753-
return None;
749+
return Some(Expr::GeomType);
754750
}
755751

756752
Some(Expr::Get(property_name.clone()))
@@ -847,7 +843,7 @@ impl MlExpr {
847843
Box::new(ExprValue::Null.into()),
848844
),
849845
MlExpr::In { item, array } => contains(item, array)?,
850-
MlExpr::NotIn { item, array } => contains(item, array)?,
846+
MlExpr::NotIn { item, array } => Expr::Not(Box::new(contains(item, array)?)),
851847
MlExpr::Interpolate {
852848
interpolation,
853849
input,
@@ -1136,7 +1132,7 @@ fn parse_expr_array(mut arr: Vec<Value>) -> Result<MlExpr, String> {
11361132
}
11371133

11381134
"in" => {
1139-
let item = box_expr(take_arg(&mut args, 1, "!in")?)?;
1135+
let item = box_expr(take_arg(&mut args, 1, "in")?)?;
11401136
let mut vals = vec![];
11411137
let mut index = 2;
11421138
while !args.is_empty() {
@@ -1152,7 +1148,7 @@ fn parse_expr_array(mut arr: Vec<Value>) -> Result<MlExpr, String> {
11521148
let mut vals = vec![];
11531149
let mut index = 2;
11541150
while !args.is_empty() {
1155-
vals.push(expr_from_value(take_arg(&mut args, index, "in")?)?);
1151+
vals.push(expr_from_value(take_arg(&mut args, index, "!in")?)?);
11561152
index += 1;
11571153
}
11581154

0 commit comments

Comments
 (0)