Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug add pro_com #45 #46

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions istatcelldata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'municipalities_root': ("census_1991", BOUNDARIES_DATA_FOLDER, "Limiti1991", "Com1991", "Com1991_WGS84.shp"),
'municipalities_column': ['PRO_COM', 'COMUNE', 'COD_REG', 'COD_PROV'],
'census_shp_root': ("census_1991", GEODATA_FOLDER),
'census_shp_column': ['SEZ1991', 'TIPO_LOC', GEOMETRY_COLUMN_NAME],
'census_shp_column': ['SEZ1991', 'TIPO_LOC', 'PRO_COM', GEOMETRY_COLUMN_NAME],
'tipo_loc_mapping': {
1: 'centro abitato',
2: 'nucleo abitato',
Expand All @@ -41,7 +41,7 @@
'municipalities_root': ("census_2001", BOUNDARIES_DATA_FOLDER, "Limiti2001", "Limiti2001", "Com2001", "Com2001_WGS84.shp"),
'municipalities_column': ['PRO_COM', 'COMUNE', 'COD_REG', 'COD_PROV'],
'census_shp_root': ("census_2001", GEODATA_FOLDER),
'census_shp_column': ['SEZ2001', 'TIPO_LOC', GEOMETRY_COLUMN_NAME],
'census_shp_column': ['SEZ2001', 'TIPO_LOC', 'PRO_COM', GEOMETRY_COLUMN_NAME],
'tipo_loc_mapping': {
1: 'centro abitato',
2: 'nucleo abitato',
Expand All @@ -62,7 +62,7 @@
'municipalities_column': ['PRO_COM', 'COMUNE', 'COD_REG', 'COD_PRO'],
'municipalities_column_remapping': {'COD_PRO': 'COD_PROV'},
'census_shp_root': ("census_2011", GEODATA_FOLDER),
'census_shp_column': ['SEZ2011', 'TIPO_LOC', GEOMETRY_COLUMN_NAME],
'census_shp_column': ['SEZ2011', 'TIPO_LOC', 'PRO_COM', GEOMETRY_COLUMN_NAME],
'tipo_loc_mapping': {
1: 'centro abitato',
2: 'nucleo abitato',
Expand All @@ -80,7 +80,7 @@
'municipalities_root': ("census_2021", BOUNDARIES_DATA_FOLDER, "Limiti2021", "Com2021", "Com2021.shp"),
'municipalities_column': ['PRO_COM', 'COMUNE', 'COD_REG'],
'census_shp_root': ("census_2021", GEODATA_FOLDER),
'census_shp_column': ['SEZ21_ID', 'TIPO_LOC', GEOMETRY_COLUMN_NAME],
'census_shp_column': ['SEZ21_ID', 'TIPO_LOC', 'PRO_COM', GEOMETRY_COLUMN_NAME],
'census_shp_column_remapping': {'SEZ21_ID': 'SEZ2021'},
'tipo_loc_mapping': {
1: 'centro abitato',
Expand Down
4 changes: 2 additions & 2 deletions istatcelldata/geodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ def read_census(
if census_geometry is not None:
census_geometry = make_valid(census_geometry) # Corregge la geometria se necessario
tipo_loc = tipo_loc_mapping.get(row[1], None) # Mappa il codice di località
census_row = [row[0], row[1], tipo_loc, census_geometry]
census_row = [row[0], row[1], tipo_loc, row[2], census_geometry]
census_cells.append(census_row)
else:
logging.warning(f"Per la sezione {row[0]} la geometria è `None` o irreparabilmente danneggiata.")
pass

df_columns = columns_list[0] # Recupera i nomi delle colonne
df_columns.insert(df_columns.index(GEOMETRY_COLUMN_NAME), 'DEN_LOC') # Aggiunge 'DEN_LOC' come colonna
df_columns.insert(df_columns.index('PRO_COM'), 'DEN_LOC') # Aggiunge 'DEN_LOC' come colonna
logging.info(f"Colonne finali: {df_columns}")

# Creazione del DataFrame e GeoDataFrame
Expand Down