Skip to content

Commit b806947

Browse files
committed
reverse point order of polygon to counter-clockwise
1 parent 6ec7814 commit b806947

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
@@ -239,7 +239,7 @@ def bbox2wktpolygon(bbox):
239239
bbox = wktenvelope2bbox(bbox)
240240
minx, miny, maxx, maxy = [f"{float(coord):.{precision}f}" for coord in bbox.split(",")]
241241
wktGeometry = 'POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' \
242-
% (minx, miny, minx, maxy, maxx, maxy, maxx, miny, minx, miny)
242+
% (minx, miny, maxx, miny, maxx, maxy, minx, maxy, minx, miny)
243243
return wktGeometry
244244

245245

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
@@ -144,13 +144,13 @@ def test_wkt2geom(wkt, bounds, expected):
144144
@pytest.mark.parametrize("bbox, expected", [
145145
(
146146
"0.0, 10.0, 30.0, 15.0",
147-
"POLYGON((0.00 10.00, 0.00 15.00, 30.00 15.00, "
148-
"30.00 10.00, 0.00 10.00))"
147+
"POLYGON((0.00 10.00, 30.00 10.00, 30.00 15.00, "
148+
"0.00 15.00, 0.00 10.00))"
149149
),
150150
(
151151
"-10.0, 10.0, 30.0, 15.0",
152-
"POLYGON((-10.00 10.00, -10.00 15.00, 30.00 15.00, "
153-
"30.00 10.00, -10.00 10.00))"
152+
"POLYGON((-10.00 10.00, 30.00 10.00, 30.00 15.00, "
153+
"-10.00 15.00, -10.00 10.00))"
154154
)
155155
])
156156
def test_bbox2wktpolygon(bbox, expected):

0 commit comments

Comments
 (0)