From b85fa9c4d610d2760daf7decd6c01b63aaeeedb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Wed, 14 Feb 2024 17:47:57 +0000 Subject: [PATCH] Also backpedal a bit on geometry change --- flow/model/qvalue/qvalue.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/flow/model/qvalue/qvalue.go b/flow/model/qvalue/qvalue.go index 17819361ec..11150a4daa 100644 --- a/flow/model/qvalue/qvalue.go +++ b/flow/model/qvalue/qvalue.go @@ -288,14 +288,23 @@ func compareHstore(value1, value2 interface{}) bool { } func compareGeometry(value1, value2 interface{}) bool { - geo1 := value1.(*geom.Geom) - geo2, err := geom.NewGeomFromWKT(value2.(string)) if err != nil { panic(err) } - return geo1.Equals(geo2) + switch v1 := value1.(type) { + case *geom.Geom: + return v1.Equals(geo2) + case string: + geo1, err := geom.NewGeomFromWKT(v1) + if err != nil { + panic(err) + } + return geo1.Equals(geo2) + default: + panic(fmt.Sprintf("invalid geometry value type %T: %v", value1, value1)) + } } func compareStruct(value1, value2 interface{}) bool {