I am trying to insert points geometry into PostGIS database. Well I tried to use a function just to read point coordinates and attributes and save them in a table in PostGIS. It works for attributes but not for geometry. This is my python code:
insert(id, Height, X, Y)
....
def insert(gid,height, X, Y):
gid=str(gid)
connection = psycopg2.connect(host='', dbname='postgres', user='', password='')
cur = connection.cursor()
cur.execute ("""INSERT INTO gronkarta.test5 (gid, height, geom) VALUES (""" + gid + """,""" + str(height) + ""","""+ST_GeomFromText('POINT(X Y)', 3008)+""");""")
insert(id, Height, X, Y)
....
def insert(gid,height, X, Y):
gid=str(gid)
connection = psycopg2.connect(host='', dbname='postgres', user='', password='')
cur = connection.cursor()
cur.execute ("""INSERT INTO gronkarta.test5 (gid, height, geom) VALUES (""" + gid + """,""" + str(height) + ""","""+ST_GeomFromText('POINT(X Y)', 3008)+""");""")