Skip to content

Commit 76dd55f

Browse files
committed
feat(cli): add CLI command for generalize points
1 parent 3481ebe commit 76dd55f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/geogenalg/main.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from geogenalg.application.generalize_clusters_to_centroids import (
1414
GeneralizePointClustersAndPolygonsToCentroids,
1515
)
16+
from geogenalg.application.generalize_points import GeneralizePoints
1617

1718

1819
class GeoPackageURI:
@@ -122,6 +123,30 @@ def clusters_to_centroids(
122123
output.to_file(output_geopackage.file, layer=output_geopackage.layer_name)
123124

124125

126+
@app.command()
127+
def points(
128+
input_geopackage: GeoPackageArgument,
129+
output_geopackage: GeoPackageArgument,
130+
reduce_threshold: Annotated[float, typer.Option()],
131+
displace_threshold: Annotated[float, typer.Option()],
132+
displace_points_iterations: Annotated[int, typer.Option()],
133+
unique_key_column: Annotated[str, typer.Option()],
134+
cluster_members_column: Annotated[str, typer.Option()],
135+
) -> None:
136+
"""Execute Generalize points algorithm."""
137+
algorithm = GeneralizePoints(
138+
reduce_threshold=reduce_threshold,
139+
displace_threshold=displace_threshold,
140+
displace_points_iterations=displace_points_iterations,
141+
unique_key_column=unique_key_column,
142+
cluster_members_column=cluster_members_column,
143+
)
144+
145+
in_gdf = read_file(input_geopackage.file, layer=input_geopackage.layer_name)
146+
output = algorithm.execute(in_gdf, reference_data={})
147+
output.to_file(output_geopackage.file, layer=output_geopackage.layer_name)
148+
149+
125150
def main() -> None:
126151
"""Execute typer application."""
127152
app()

0 commit comments

Comments
 (0)