update
This commit is contained in:
parent
b63dbb731e
commit
375faef7fa
@ -4,10 +4,8 @@
|
|||||||
|
|
||||||
import geopandas as gpd
|
import geopandas as gpd
|
||||||
from geoalchemy2 import Geometry
|
from geoalchemy2 import Geometry
|
||||||
|
|
||||||
from sqlalchemy.engine import URL
|
|
||||||
from sqlalchemy import create_engine
|
|
||||||
import pycen
|
import pycen
|
||||||
|
import pycen.wfs
|
||||||
|
|
||||||
# con = conn
|
# con = conn
|
||||||
con = pycen.con_gn
|
con = pycen.con_gn
|
||||||
@ -33,6 +31,40 @@ def update_larea(df, cols_updt=[]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
dic = {
|
||||||
|
'ID_ENS':'area_code',
|
||||||
|
'ENS_Id':'area_code',
|
||||||
|
'Id':'area_code',
|
||||||
|
'ID':'area_code',
|
||||||
|
'NOM':'area_name',
|
||||||
|
'Nom_ens':'area_name',
|
||||||
|
# 'URL':'source',
|
||||||
|
}
|
||||||
|
# pycen.wfs.list_layer('http://ws.carmencarto.fr/WFS/94/ENS_CG38')
|
||||||
|
df = pycen.wfs.get_wfs('http://ws.carmencarto.fr/WFS/94/ENS_CG38', 'zone_d_intervention_02')
|
||||||
|
df.rename(columns=dic,inplace=True)
|
||||||
|
df = df[[*set(dic.values()),'geometry']]
|
||||||
|
df.rename_geometry('geom', inplace=True)
|
||||||
|
df['id_type'] = 35
|
||||||
|
df['geojson_4326'] = df.to_crs(4326).geom.__geo_interface__['features']
|
||||||
|
df['geojson_4326'] = [x['geometry'] for x in df['geojson_4326']]
|
||||||
|
# df['geojson_4326'] = df['geojson_4326'].astype(str)
|
||||||
|
df['centroid'] = df.geom.centroid.to_wkt()
|
||||||
|
df['enable'] = True
|
||||||
|
df['source'] = 'http://ws.carmencarto.fr/WFS/94/ENS_CG38'
|
||||||
|
|
||||||
|
df.to_postgis(
|
||||||
|
name='l_areas',
|
||||||
|
con=con,
|
||||||
|
schema='ref_geo',
|
||||||
|
if_exists='append',
|
||||||
|
index=False,
|
||||||
|
index_label=None,
|
||||||
|
chunksize=None,
|
||||||
|
dtype={
|
||||||
|
'centroid': Geometry(geometry_type='POINT',srid=2154)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
# path0 = '/home/colas/Documents/5_BDD/BASSIN_VERSANT/'
|
# path0 = '/home/colas/Documents/5_BDD/BASSIN_VERSANT/'
|
||||||
path0 = '/home/colas/Documents/9_PROJETS/6_GEONATURE/AREA/'
|
path0 = '/home/colas/Documents/9_PROJETS/6_GEONATURE/AREA/'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user