enzococca / Survey123ToLayer

This application provides a graphical user interface (GUI) for converting data from a SQLite database into GeoPackage and Shapefile formats, with optional filtering by keywords. It is built using PyQt5 and integrates with geospatial libraries to handle the conversion process.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using the code with polygon survey

Eslam-mohakim opened this issue · comments

when trying to use the same code df["geometry"] = df["area"].apply(create_geometry) but for area for Polygon type, it fires this error:
"ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (25,) + inhomogeneous part."

this is the function:
def create_geometry(x): if x == x and isinstance(x, dict) and "rings" in x and isinstance(x["rings"], list) and len(x["rings"]) > 0: return Polygon(coordinates) else: return np.nan

commented
commented

Furthermore, you should then apply the create_geometry function instead of:

df["geometry"] = df["location"].apply(
lambda x: Polygon(x["rings"][0])
)
in

df["geometry"] = df["area"].apply(create_geometry)
)