You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thanks for this project.
I see a need to convert from GPKG->CSV file format starting out from #39. I have written a first script to compile from attached sample file buildings from a GPKG-package into CSV format. Thus one should be able to edit a GPKG-file through GIS and later serve as model input.
Best regards
Sebastian
"""Sources:Polyline geometry with attribute measuredHeight to be converted into CSV format as per documentationcsv2building_polygons(file name, floor height=3)Module: shallow_water.data_managerConvert CSV files of the form:easting,northing,id,floors422664.22,870785.46,2,0422672.48,870780.14,2,0422668.17,870772.62,2,0422660.35,870777.17,2,0422664.22,870785.46,2,0422661.30,871215.06,3,1422667.50,871215.70,3,1422668.30,871204.86,3,1422662.21,871204.33,3,1422661.30,871215.06,3,1https://stackoverflow.com/questions/69859170/how-acess-get-extract-the-values-of-polygon-in-a-geometry-column-of-geopandas-dahttps://stackoverflow.com/questions/56709561/how-to-smartly-loop-over-all-points-in-a-geodataframe-and-look-at-nearest-neighttps://stackoverflow.com/questions/44513738/pandas-create-empty-dataframe-with-only-column-nameshttps://stackoverflow.com/questions/16923281/writing-a-pandas-dataframe-to-csv-file#16923367"""importpandasaspdimportgeopandasasgpddefcoord_lister(geom):
coords=list(geom.exterior.coords)
return (coords)
defwrite_csv_files(row):
dir_path='./'file_name=dir_path+'_building_'+str(row.id) +'.csv'coords=coord_lister(row.geometry)
df=pd.DataFrame(columns=['easting','northing','id','floors'])
forxyincoords:
df.loc[len(df)] = [xy[0], xy[1], int(row.id), int(row.floors)]
df['id'] =df['id'].astype(int)
df['floors'] =df['floors'].astype(int)
df.to_csv(file_name, sep=',', header=True, index=None)
return(file_name)
if__name__=="__main__":
gdf=gpd.read_file("buildings_mod.gpkg")
forindex,rowingdf.iterrows():
file_name=write_csv_files(row)
print("Writing file "+str(file_name))
print("Files have been written\n")
Dear all,
thanks for this project.
I see a need to convert from GPKG->CSV file format starting out from #39. I have written a first script to compile from attached sample file buildings from a GPKG-package into CSV format. Thus one should be able to edit a GPKG-file through GIS and later serve as model input.
Best regards
Sebastian
buildings_mod.zip
The text was updated successfully, but these errors were encountered: