diff --git a/cmm_single_processes/convert_to_csv.py b/cmm_single_processes/convert_to_csv.py new file mode 100644 index 0000000..c3d050a --- /dev/null +++ b/cmm_single_processes/convert_to_csv.py @@ -0,0 +1,29 @@ +from scrub_layer_class import * +import pandas as pd + +qgis_path = 'C:/Program Files/QGIS 3.34.1/apps/qgis' +cmm_path = \ + 'C:/Users/a_adli/PycharmProjects/cmm_gis_oo/' \ + 'data/output_data/cmm_points_function_vintage_surface/' \ + 'cmm_points_function_vintage_surface.shp' + +cmm = ScrubLayer(qgis_path, cmm_path, 'QC GDTable') + + +field_names = ['id_provinc', 'mat_18', 'code_util', 'superficie', + 'nom_etage', 'anne_cnstr', 'supfi_etag', 'typ_btmn', 'nom_logm'] + +# Get the indices of the specified fields +field_indices = [cmm.layer.fields().indexOf(field) for field in field_names] + +# Extract the attribute values and store them in a list of dictionaries +data = [] +for feature in cmm.layer.getFeatures(): + attributes = [feature.attributes()[index] for index in field_indices] + data.append(dict(zip(field_names, attributes))) + +# Create a DataFrame from the list of dictionaries +df = pd.DataFrame(data) + +df.to_csv('../data/csv_files/cmm_points_function_vintage_surface.csv', + index=False) diff --git a/cmm_single_processes/remove_the_island.py b/cmm_single_processes/remove_the_island.py new file mode 100644 index 0000000..e69de29