Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pygeofilter/cql2.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"s_overlaps": ast.GeometryOverlaps,
"s_crosses": ast.GeometryCrosses,
"s_contains": ast.GeometryContains,
"s_dwithin": ast.DistanceWithin,
}

TEMPORAL_PREDICATES_MAP: Dict[str, Type[ast.TemporalPredicate]] = {
Expand Down
24 changes: 12 additions & 12 deletions tests/parsers/cql_json/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,18 +597,18 @@ def test_overlaps_attr_multilinestring():

# # dwithin/beyond

# def test_dwithin_attr_polygon():
# result = parse('DWITHIN(geometry, POLYGON((1 1,2 2,0 3,1 1)), 5, feet)')
# print(get_repr(result))
# assert result == ast.SpatialDistancePredicateNode(
# ast.Attribute('geometry'),
# ast.LiteralExpression(
# geometry.Polygon([(1, 1), (2, 2), (0, 3), (1, 1)])
# ),
# ast.SpatialDistanceOp('DWITHIN'),
# distance=5,
# units='feet',
# )

def test_dwithin_attr_polygon():
result = parse("DWITHIN(geometry, POLYGON((1 1,2 2,0 3,1 1)), 5, feet)")
assert result == ast.SpatialDistancePredicateNode(
ast.Attribute("geometry"),
ast.LiteralExpression(
geometry.Polygon([(1, 1), (2, 2), (0, 3), (1, 1)])
),
ast.SpatialDistanceOp("DWITHIN"),
distance=5,
units="feet",
)


# def test_beyond_attr_polygon():
Expand Down
Loading