[gdal-dev] GDAL question

Peter P pepanpeter at gmail.com
Wed Apr 21 01:14:30 PDT 2021


PostgreSQL "table1" columns:
Name Data Type
Id integer
Name text
TestGeometry geometry

Example geojson - this will be one row in table:
jsonVariable = {"type": "FeatureCollection", "Name": "testName", "features":
[{"type": "Feature", "geometry": {"type": "Polygon", "coordinates":
[[[26.54296875,64.73664139557683],[26.630859375,63.6267446447533],[29.091796875,63.97596090918338],[26.54296875,64.73664139557683]]]}}]}

Example python
ogr2ogr.main(["", "-f", "PostgreSQL", "-s_srs", "+proj=longlat +datum=WGS84
+no_defs", "-t_srs", "EPSG:3857", "PG:dbname='test' host='127.0.0.1'
port='5432' user='user1' password='password1'", "-nln", "table1", "-append",
json.dumps(jsonVariable)])




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list