Geographic Information Systems Asked on September 30, 2021
I want to convert spatial data from postgres to some basic formats (shp, geopackage, csv, xlsx, gml… ) using python gdal functionality. I read the answer to this question: Using ogr2ogr to convert GML to shapefile in Python?
I downloaded ogr2ogr.py and tried to convert data from postgres to some formats but I get an error saying:
KML driver failed to create /home/.../out.kml
This is the method I am using:
ogr2ogr.main(["", "-f", "KML", "/home/.../out.kml",
"PG:dbname='dbname' host='host' port=5432 user='username' password='password'",
"-sql", "SELECT column1, column2 FROM schema.table"])
I'm not sure about the select column part but this should produce the entire table in kml:
ogr2ogr.main(["", "-f", "KML", "/home/.../out.kml",
"PG:dbname='dbname' host='host' port=5432 user='username' password='password'","table"])
Answered by artwork21 on September 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP