I am writing a python script attempting to insert GeoJSON Polygon coordinates into a Postgres table. I am writing a basic insertion code since I am new to GIS domain.
The code look like this:
createTableMain = "create table "+ tablename +" (id TEXT PRIMARY KEY DEFAULT NULL,Name TEXT DEFAULT NULL,type TEXT DEFAULT NULL ,wkt_geom GEOMETRY DEFAULT NULL)";
print(createTableMain)
cursor.execute(createTableMain)
with open(datapath, 'r') as f:
next(f)
cursor.copy_from(f, tablename, sep='|')
conn.commit()
conn.commit()
cursor.close()
conn.close()
The data insert properly but the wkt_geom column does not contain data with multi-polygon and polygon format. It looks like this (seems like it as text).
I am reading the data from a text file, so I seek a solution with respect to that.