【发布时间】:2018-03-31 02:09:57
【问题描述】:
我有一个csv,其中包括一个东向和北向、东向和北向2、东向3 和北向3 以在qgis 中创建一个多边形,所有东向和北向属性都是数字。
代码如下:
import os
import csv
import psycopg2
import time
conn = psycopg2.connect (host="xxxx", database="xxxx", user="xxxx"
,password="xxxx", port="xxxx")
delete="ALTER Table highloading_qgis DROP COLUMN geom;"
tem_delete="DELETE FROM public.highloading_qgis;"
tem_carrier="copy highloading_qgis
FROM'/home/ftpuser/Report/highloading_new.csv' With DELIMITER ',' CSV
HEADER;"
add_col="ALTER TABLE highloading_qgis ADD COLUMN geom geometry;"
update_gpis="UPDATE highloading_qgis SET geom =
(ST_MakePolygon(ST_GeomFromText('LINESTRING('Easting' 'Northing','Easting2'
'Northing2','Easting3' 'Northing3')')));"
cursor = conn.cursor()
cursor.execute(delete)
cursor.execute(tem_delete)
cursor.execute(tem_carrier)
cursor.execute(add_col)
cursor.execute(update_gpis)
cursor.close()
conn.commit()
conn.close()
但是执行 cursor.execute(update_gpis) 时发现错误"
ProgrammingError: syntax error at or near "Easting"
LINE 1: ...om = (ST_MakePolygon(ST_GeomFromText('LINESTRING('Easting' '...
^
任何人都可以帮助如何更正将多边形几何图形添加到 pgadmin??
【问题讨论】:
标签: python polygon pgadmin qgis