Skip to content

Commit

Permalink
propogate parameters only_convert_closed_polylines and verify_informa…
Browse files Browse the repository at this point in the history
…tion_model to convert_polylines_to_polygons()
  • Loading branch information
michaelchin committed Dec 6, 2024
1 parent 37e0fec commit 2d7561e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions gplately/utils/convert_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ def convert_polylines_to_polygons_within_feature(
)


def convert_polylines_to_polygons(feature_collection: pygplates.FeatureCollection):
def convert_polylines_to_polygons(
feature_collection: pygplates.FeatureCollection,
only_convert_closed_polylines=True,
verify_information_model=pygplates.VerifyInformationModel.yes,
):
"""convert all polylines in a given feature collection to polygons
Parameters
Expand All @@ -71,8 +75,8 @@ def convert_polylines_to_polygons(feature_collection: pygplates.FeatureCollectio
for feature in feature_collection:
convert_polylines_to_polygons_within_feature(
feature,
only_convert_closed_polylines=False,
verify_information_model=pygplates.VerifyInformationModel.no,
only_convert_closed_polylines=only_convert_closed_polylines,
verify_information_model=verify_information_model,
)


Expand Down
6 changes: 5 additions & 1 deletion tests-dir/unittest/test_convert_geometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
new_feature_collection.write("polylines-in-muller2016.gpml")
#############

convert_geometries.convert_polylines_to_polygons(feature_collection)
convert_geometries.convert_polylines_to_polygons(
feature_collection,
only_convert_closed_polylines=False,
verify_information_model=pygplates.VerifyInformationModel.no,
)

# now let's see if the geometries have been converted
geometry_types = []
Expand Down

0 comments on commit 2d7561e

Please sign in to comment.