Skip to main content
added 53 characters in body
Source Link
Kirk Kuykendall
  • 25.8k
  • 8
  • 67
  • 155

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)+""");""") 

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 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)+""");""") 

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)+""");""") 
deleted 30 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

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 code and I will appreciate any help!:

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)+""");""") 

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 code and I will appreciate any help!

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)+""");""") 

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 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)+""");""") 
edited tags
Link
artwork21
  • 35.2k
  • 8
  • 67
  • 134
Rollback to Revision 1
Source Link
Loading
deleted 36 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
Source Link
Loading