Skip to content

Commit

Permalink
Add function to split WKT string into components
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Dec 3, 2024
1 parent 0dd8cca commit 300b12f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pygeoif/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,19 @@ def _multipolygon_from_wkt_coordinates(coordinates: str) -> MultiPolygon:


def split_wkt_components(wkt: str) -> List[str]:
"""
Split a WKT (Well-Known Text) string into its individual components.
This function takes a WKT string and splits it into a list of components,
ensuring that commas within nested parentheses are not considered as split points.
Args:
wkt (str): The WKT string to be split.
Returns:
List[str]: A list of strings, each representing a component of the WKT string.
"""
components = []
start = 0
open_count = 0
Expand Down

0 comments on commit 300b12f

Please sign in to comment.