Skip to content

Commit

Permalink
Update script.py
Browse files Browse the repository at this point in the history
  • Loading branch information
OliviaButters authored Sep 30, 2024
1 parent b2e6f4c commit 8d80984
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,17 @@

clipped = gpd.clip(all_builds,boundary)

# Print to a gpkg file
clipped.to_file(os.path.join(buildings_path, location + '.gpkg'),driver='GPKG',index=False)
all_builds = clipped.to_file(os.path.join(outputs_path,'all_buildings.shp'))
all_builds = gpd.read_file(os.path.join(outputs_path,'all_buildings.shp'))
all_builds = all_builds.explode()
all_builds.reset_index(inplace=True, drop=True)
all_builds1 = all_builds.to_file(os.path.join(buildings_path, location + '.gpkg'),driver='GPKG',index=False)

os.remove(os.path.join(outputs_path,'all_buildings.shp'))
os.remove(os.path.join(outputs_path,'all_buildings.cpg'))
os.remove(os.path.join(outputs_path,'all_buildings.dbf'))
os.remove(os.path.join(outputs_path,'all_buildings.prj'))
os.remove(os.path.join(outputs_path,'all_buildings.shx'))

# # Print to a gpkg file
# clipped.to_file(os.path.join(buildings_path, location + '.gpkg'),driver='GPKG',index=False)

0 comments on commit 8d80984

Please sign in to comment.