Thursday 25 February 2016

python - Adding GeoPandas Dataframe to PostGIS table?


I have a simple GeoPandas Dataframe:


enter image description here


I would like to upload this GeoDataframe to a PostGIS table. I have a Database setup with the PostGIS extension already but can't seem to add this Dataframe as a table.


I have tried the following:



engine = <>
meta = MetaData(engine)
eld_test = Table('eld_test', meta, Column('id', Integer, primary_key=True), Column('key_comb_drvr', Text),
Column('geometry', Geometry('Point', srid=4326)))
eld_test.create(engine)
conn = engine.connect()
conn.execute(eld_test.insert(), df.to_dict('records'))


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...