1

How it's currently done is as follows:

geoms = df["wkt"].apply(shapely.wkt.loads).values

Here df["wkt"] has rows with data like:

"MULTIPOLYGON (((24.2401805 70.8385222,24.2402333 70.83850555,24.2402166 70.83848885,24.24015 70.83848885,24.2401277 70.83850555,24.2401805 70.8385222)))"

But as the dataframe that the function is being applied to is huge this takes a while. Is there a way to speed this up? I've tried looking at multithreading or similar, but didn't really get it to work.

The same applies to this line:

df_geoms = [shapely.wkt.loads(x) for x in df.geom.values]
Laende
  • 167
  • 2
  • 13

1 Answers1

0

You can try the from_wkt command from the GeoPandas library:

geoms = geopandas.GeoSeries.from_wkt(df["wkt"])
Felipe D.
  • 1,157
  • 9
  • 19