init depot renew
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import geopandas as gpd
|
||||
from pycen import con_gn, update_to_sql
|
||||
from os import path
|
||||
|
||||
PATH = '/media/cgeier/SRV/FICHIERS/OUTILS/CARTOGRAPHIE/ESPACE DE TRAVAIL/ETUDES/Zones humides/2026/HUEZ_Modification zonage_ajouts ZH/'
|
||||
file = 'HUEZ_modifs 2026_AG.geojson'
|
||||
auth_id = 45
|
||||
code_zh = 'site_code'
|
||||
|
||||
zh = gpd.read_file(path.join(PATH,file))[[code_zh,'geometry']]
|
||||
|
||||
if code_zh != 'code':
|
||||
zh.rename(columns={code_zh:'code'}, inplace=True)
|
||||
|
||||
if zh.crs.srs.lower() != 'epsg:4326':
|
||||
zh.to_crs(4326,inplace=True)
|
||||
|
||||
if zh.geometry.name != 'geom':
|
||||
zh.rename_geometry('geom', inplace=True)
|
||||
|
||||
zh['area'] = zh.to_crs(2154).area / 10000
|
||||
zh['update_author'] = auth_id
|
||||
|
||||
if zh.code.is_unique:
|
||||
update_to_sql(zh,con_gn,'t_zh','pr_zh','code')
|
||||
|
||||
Reference in New Issue
Block a user