Skip to content

Commit 3fb0d0c

Browse files
committed
reverse point order of polygon to counter-clockwise
1 parent 89c9064 commit 3fb0d0c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

pycsw/core/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def bbox2wktpolygon(bbox):
245245
bbox = wktenvelope2bbox(bbox)
246246
minx, miny, maxx, maxy = [f"{float(coord):.{precision}f}" for coord in bbox.split(",")]
247247
wktGeometry = 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' \
248-
% (minx, miny, minx, maxy, maxx, maxy, maxx, miny, minx, miny)
248+
% (minx, miny, maxx, miny, maxx, maxy, minx, maxy, minx, miny)
249249
return wktGeometry
250250

251251

tests/unittests/test_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))",
4242
"POLYGON ((2 2, 2 3, 3 3, 3 2, 2 2))",
4343
],
44-
"POLYGON((0.00 0.00, 0.00 3.00, 3.00 3.00, 3.00 0.00, 0.00 0.00))"
44+
"POLYGON((0.00 0.00, 3.00 0.00, 3.00 3.00, 0.00 3.00, 0.00 0.00))"
4545
),
4646
])
4747
def test_bbox_from_polygons(bboxes, expected):

tests/unittests/test_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ def test_wkt2geom(wkt, bounds, expected):
143143
@pytest.mark.parametrize("bbox, expected", [
144144
(
145145
"0.0, 10.0, 30.0, 15.0",
146-
"POLYGON((0.00 10.00, 0.00 15.00, 30.00 15.00, "
147-
"30.00 10.00, 0.00 10.00))"
146+
"POLYGON((0.00 10.00, 30.00 10.00, 30.00 15.00, "
147+
"0.00 15.00, 0.00 10.00))"
148148
),
149149
(
150150
"-10.0, 10.0, 30.0, 15.0",
151-
"POLYGON((-10.00 10.00, -10.00 15.00, 30.00 15.00, "
152-
"30.00 10.00, -10.00 10.00))"
151+
"POLYGON((-10.00 10.00, 30.00 10.00, 30.00 15.00, "
152+
"-10.00 15.00, -10.00 10.00))"
153153
)
154154
])
155155
def test_bbox2wktpolygon(bbox, expected):

0 commit comments

Comments
 (0)