20 lines
445 B
Python
20 lines
445 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
import geopandas as gpd
|
|
import pycen
|
|
|
|
sql = 'SELECT * FROM zones_humides.v_zoneshumides'
|
|
req = gpd.read_postgis(sql,pycen.con)
|
|
|
|
df = req[~req.geom.is_valid].copy()
|
|
df.geom = df.geom.buffer(0)
|
|
df = df[['site_code','geom']].copy()
|
|
df.columns = ['id_site','geom']
|
|
df = pycen.tools.Polygons_to_MultiPolygon(df)
|
|
|
|
pycen.update_to_sql(
|
|
df,pycen.con,
|
|
'r_sites_geom','sites',
|
|
'id_site','geom'
|
|
) |