Skip to content

Commit

Permalink
force engine to pyogrio
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-97 committed Sep 3, 2024
1 parent e389c3d commit 2e8d917
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mapreader/load/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,9 @@ def convert_images(
if isinstance(parent_df_copy[col][0], (tuple, list)):
parent_df_copy[col] = parent_df_copy[col].apply(str)

parent_df_copy.to_file("parent_df.geojson", driver="GeoJSON")
parent_df_copy.to_file(
"parent_df.geojson", driver="GeoJSON", engine="pyogrio"
)
print('[INFO] Saved parent dataframe as "parent_df.geojson"')

if isinstance(patch_df, gpd.GeoDataFrame):
Expand All @@ -1627,7 +1629,9 @@ def convert_images(
if isinstance(patch_df_copy[col][0], (tuple, list)):
patch_df_copy[col] = patch_df_copy[col].apply(str)

patch_df_copy.to_file("patch_df.geojson", driver="GeoJSON")
patch_df_copy.to_file(
"patch_df.geojson", driver="GeoJSON", engine="pyogrio"
)
print('[INFO] Saved patch dataframe as "patch_df.geojson"')

else:
Expand Down Expand Up @@ -2711,12 +2715,8 @@ def save_patches_to_geojson(
if not crs:
crs = patch_df.crs

if "image_id" in patch_df.columns:
patch_df.drop(columns=["image_id"], inplace=True)
patch_df.reset_index(names="image_id", inplace=True)

# drop pixel stats columns
patch_df.drop(columns=patch_df.filter(like="pixel", axis=1), inplace=True)

# save
patch_df.to_file(geojson_fname, driver="GeoJSON")
patch_df.to_file(geojson_fname, driver="GeoJSON", engine="pyogrio")

0 comments on commit 2e8d917

Please sign in to comment.