Skip to content

Commit

Permalink
Write points as wkt
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Sep 12, 2024
1 parent 55f5971 commit 214326c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/3.3_assign_facility_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,14 @@
]


# save as parquet
activity_chains_all.to_parquet(
# save as parquet: note to serialize the geometries, need to convert
# non-missing values to e.g. wkt
geom_cols = ["start_location_geometry", "end_location_geometry"]
for col in geom_cols:
activity_chains_all.loc[:, col + "_wkt"] = activity_chains_all[col].map(
lambda point: point if pd.isna(point) else point.wkt
)
activity_chains_all.drop(columns=geom_cols).to_parquet(
acbm.root_path / "data/processed/activities_pam/legs_with_locations.parquet"
)

Expand Down

0 comments on commit 214326c

Please sign in to comment.