|
10 | 10 | from buildpg.funcs import AND as and_ |
11 | 11 | from buildpg.funcs import NOT as not_ |
12 | 12 | from buildpg.funcs import OR as or_ |
13 | | -from buildpg.funcs import any, cast |
| 13 | +from buildpg.funcs import any |
14 | 14 | from buildpg.logic import Func |
15 | 15 | from geojson_pydantic.geometries import Polygon, parse_geometry_obj |
16 | 16 |
|
@@ -61,18 +61,44 @@ class Operator: |
61 | 61 | "INTERSECTS": lambda f, a: Func( |
62 | 62 | "st_intersects", |
63 | 63 | f, |
64 | | - Func("st_transform", cast(a, "geometry"), Func("st_srid", f)), |
| 64 | + Func("st_transform", a, Func("st_srid", f)), |
| 65 | + ), |
| 66 | + "DISJOINT": lambda f, a: Func( |
| 67 | + "st_disjoint", f, Func("st_transform", a, Func("st_srid", f)) |
| 68 | + ), |
| 69 | + "CONTAINS": lambda f, a: Func( |
| 70 | + "st_contains", f, Func("st_transform", a, Func("st_srid", f)) |
| 71 | + ), |
| 72 | + "WITHIN": lambda f, a: Func( |
| 73 | + "st_within", f, Func("st_transform", a, Func("st_srid", f)) |
| 74 | + ), |
| 75 | + "TOUCHES": lambda f, a: Func( |
| 76 | + "st_touches", f, Func("st_transform", a, Func("st_srid", f)) |
| 77 | + ), |
| 78 | + "CROSSES": lambda f, a: Func( |
| 79 | + "st_crosses", |
| 80 | + f, |
| 81 | + Func("st_transform", a, Func("st_srid", f)), |
| 82 | + ), |
| 83 | + "OVERLAPS": lambda f, a: Func( |
| 84 | + "st_overlaps", |
| 85 | + f, |
| 86 | + Func("st_transform", a, Func("st_srid", f)), |
| 87 | + ), |
| 88 | + "EQUALS": lambda f, a: Func( |
| 89 | + "st_equals", |
| 90 | + f, |
| 91 | + Func("st_transform", a, Func("st_srid", f)), |
| 92 | + ), |
| 93 | + "RELATE": lambda f, a, pattern: Func( |
| 94 | + "st_relate", f, Func("st_transform", a, Func("st_srid", f)), pattern |
| 95 | + ), |
| 96 | + "DWITHIN": lambda f, a, distance: Func( |
| 97 | + "st_dwithin", f, Func("st_transform", a, Func("st_srid", f)), distance |
| 98 | + ), |
| 99 | + "BEYOND": lambda f, a, distance: ~Func( |
| 100 | + "st_dwithin", f, Func("st_transform", a, Func("st_srid", f)), distance |
65 | 101 | ), |
66 | | - "DISJOINT": lambda f, a: Func("st_disjoint", f, a), |
67 | | - "CONTAINS": lambda f, a: Func("st_contains", f, a), |
68 | | - "WITHIN": lambda f, a: Func("st_within", f, a), |
69 | | - "TOUCHES": lambda f, a: Func("st_touches", f, a), |
70 | | - "CROSSES": lambda f, a: Func("st_crosses", f, a), |
71 | | - "OVERLAPS": lambda f, a: Func("st_overlaps", f, a), |
72 | | - "EQUALS": lambda f, a: Func("st_equals", f, a), |
73 | | - "RELATE": lambda f, a, pattern: Func("st_relate", f, a, pattern), |
74 | | - "DWITHIN": lambda f, a, distance: Func("st_dwithin", f, a, distance), |
75 | | - "BEYOND": lambda f, a, distance: ~Func("st_dwithin", f, a, distance), |
76 | 102 | "+": lambda f, a: f + a, |
77 | 103 | "-": lambda f, a: f - a, |
78 | 104 | "*": lambda f, a: f * a, |
|
0 commit comments