From 028972c3f36b7b5ada6f42682f17ab16491db9de Mon Sep 17 00:00:00 2001 From: prabinoid <38830224+prabinoid@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:07:35 +0545 Subject: [PATCH] Split task url and geom fixed --- backend/api/tasks/actions.py | 2 +- backend/services/grid/split_service.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/api/tasks/actions.py b/backend/api/tasks/actions.py index 41d727cdf4..82001e1453 100644 --- a/backend/api/tasks/actions.py +++ b/backend/api/tasks/actions.py @@ -964,7 +964,7 @@ async def post( return JSONResponse(content={"Success": "All tasks reset"}, status_code=200) -@router.post("/{project_id}/tasks/{task_id}/actions/split/") +@router.post("/{project_id}/tasks/actions/split/{task_id}/") async def post( request: Request, project_id: int, diff --git a/backend/services/grid/split_service.py b/backend/services/grid/split_service.py index e694c2973b..b56ccb5220 100644 --- a/backend/services/grid/split_service.py +++ b/backend/services/grid/split_service.py @@ -127,13 +127,13 @@ async def _create_split_tasks_from_geometry(task, db) -> list: # convert split geometries into GeoJSON features expected by Task split_features = [] for split_geometry in split_geometries: - multipolygon_geometry = shape.from_shape(split_geometry, 4326) + multipolygon_geometry_wkt = split_geometry.wkt multipolygon_as_geojson_query = """ - SELECT ST_AsGeoJSON(ST_Transform(ST_SetSRID(ST_Multi(:multipolygon_geometry), 4326), 4326)) AS geojson + SELECT ST_AsGeoJSON(ST_Transform(ST_SetSRID(ST_Multi(ST_GeomFromText(:multipolygon_geometry)), 4326), 4326)) AS geojson """ feature_geojson = await db.fetch_val( multipolygon_as_geojson_query, - values={"multipolygon_geometry": multipolygon_geometry}, + values={"multipolygon_geometry": multipolygon_geometry_wkt}, ) feature = geojson.Feature(geometry=geojson.loads(feature_geojson)) feature.properties["x"] = None