Import .shp into postgre using ogr2ogr

المشرف العام

Administrator
طاقم الإدارة
I'm trying to import a .shp into postgre using ogr2ogr but i'm stuck with an error with the select clause, any ideas?

##vsmap_path=vector##millesime=number 2015from qgis.core import *import osparam = {'host':'x.xxx.xx.xx','dbname':'xxxxx' ,'port':'xxxx','user':'xxxxx','password':'xxxxxx'}ogrPath = "/".join(QgsApplication.prefixPath().split("/")[:-2])+"/bin/"#Definie le chemin de OGRvsmapLayer=processing.getObject(vsmap_path)#Transforme la couche en objetvsmapName = vsmapLayer.name()+'_'+str(millesime) #Change le nom de le couchecommande="""ogr2ogr -f "PostgreSQL" -a_srs "EPSG:2154" PG:"host='{host}' dbname='{dbname}' port='{port}' user='{user}' password='{password}'" -lco SCHEMA="0-reseau" -lco OVERWRITE=YES -lco FID=pkey -sql "SELECT lib_rte FROM {vsmap} WHERE gestionnaire='DIRNO'" '{vsmap_path}' --config OGR_TRUNCATE=YES PG_USE_COPY=YES""".format(vsmap=vsmapName,vsmap_path=vsmap_path,**param)new_commande = "echo import en cours... & "+ogrPath+commandeos.system(new_commande)

أكثر...
 
أعلى