Skip to content

Commit

Permalink
fix: solved unsupported multi-linestring custom feature issue in odk … (
Browse files Browse the repository at this point in the history
#865)

* fix: solved unsupported multi-linestring custom feature issue in odk form

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: sujanadh <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 29, 2023
1 parent 7029fe1 commit 56e3676
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@
from osm_fieldwork.OdkCentral import OdkAppUser
from osm_fieldwork.xlsforms import xlsforms_path
from shapely import wkt
from shapely.geometry import MultiPolygon, Polygon, mapping, shape
from shapely.geometry import (
LineString,
MultiLineString,
MultiPolygon,
Polygon,
mapping,
shape,
)
from sqlalchemy import and_, column, func, inspect, select, table, text
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.orm import Session
Expand Down Expand Up @@ -1161,6 +1168,10 @@ def upload_custom_data_extracts(
wkb_element = from_shape(
Polygon(feature["geometry"]["coordinates"][0][0]), srid=4326
)
elif isinstance(feature_shape, MultiLineString):
wkb_element = from_shape(
LineString(feature["geometry"]["coordinates"][0]), srid=4326
)
else:
wkb_element = from_shape(feature_shape, srid=4326)

Expand Down

0 comments on commit 56e3676

Please sign in to comment.