This commit is contained in:
parent
04cc438323
commit
862c43e54c
|
@ -2,15 +2,14 @@ import uuid
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
GT = 'host=210.77.68.250 port=5432 dbname=g214g214_test user=g214 password=g214G214'
|
GT = 'host=210.77.68.250 port=5432 dbname=qilianshan user=qilianshan password=g214G214'
|
||||||
G = 'host=210.77.68.250 port=5432 dbname=g214db user=g214 password=g214G214'
|
G = 'host=210.77.68.250 port=5432 dbname=sanjiangyuan user=sanjiangyuan password=g214G214'
|
||||||
|
|
||||||
|
|
||||||
def insert_section(code, the_geom):
|
def insert_section(id, atitle):
|
||||||
with psycopg2.connect(G) as connection:
|
with psycopg2.connect(G) as connection:
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
id = uuid.uuid4()
|
sql = "insert into areas (id, atitle) values ('%s', '%s')" % (id, atitle)
|
||||||
sql = "insert into base_section (id, code, rtu, box, the_geom) values ('%s', '%s', false, false, st_geometryfromtext('%s', 4326))" % (id, code, the_geom)
|
|
||||||
print sql
|
print sql
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
@ -20,11 +19,12 @@ def insert_section(code, the_geom):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with psycopg2.connect(GT) as connection:
|
with psycopg2.connect(GT) as connection:
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
cursor.execute('select cmt, st_astext(geom) from observ_ponits ')
|
cursor.execute('select * from areas ')
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
for r in results:
|
for r in results:
|
||||||
code = r[0].upper()
|
id = r[0]
|
||||||
the_geom = r[1]
|
atitle = r[1]
|
||||||
|
|
||||||
print code, the_geom
|
|
||||||
insert_section(code, the_geom)
|
print id,atitle
|
||||||
|
#insert_section(id, atitle)
|
|
@ -0,0 +1,15 @@
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
G = 'host=210.77.68.250 port=5432 dbname=sanjiangyuan user=sanjiangyuan password=g214G214'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
with open("specimen_gs_matched.csv") as f:
|
||||||
|
for r in f:
|
||||||
|
print r
|
|
@ -27,4 +27,4 @@ if __name__ == '__main__':
|
||||||
name = r[2]
|
name = r[2]
|
||||||
|
|
||||||
print id,code, name
|
print id,code, name
|
||||||
update_probe(id, code, name)
|
#update_probe(id, code, name)
|
||||||
|
|
Loading…
Reference in New Issue