<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>Send gdal-dev mailing list submissions to<br>
        <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:gdal-dev-request@lists.osgeo.org" target="_blank">gdal-dev-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:gdal-dev-owner@lists.osgeo.org" target="_blank">gdal-dev-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of gdal-dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. 

Re: GDAL question (Peter P)<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br></blockquote><div><br></div><div><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">PostgreSQL "table1" columns:</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">Name Data Type</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">Id integer</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">Name text</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">TestGeometry geometry</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">Example geojson - this will be one row in table:</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">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]]]}}]}</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">Example python</span><br style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px"><span style="color:rgb(0,0,0);font-family:Verdana,Geneva,Helvetica,Arial,sans-serif;font-size:13.44px">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)])</span><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><quote author="jratike80"><br>Hi,<br><br>Ogr2ogr by default converts all the columns so you should not need to do<br>anything. Test first ogr2ogr from the command line without mixing Python<br>into the soup. If you still do not get your "name" attribute converted you<br>may have something special in your data, like a few first features in the<br>GeoJSON missing the name attribute.<br><br>Do you really mean "wkt_geometry" or is it possibly "wkb_geometry"?<br><br>If you will still have troubles please share some test data.<br><br>-Jukka Rahkonen- <br><br><br><br>Peter P wrote<br>> Hello<br>> <br>> I use GDAL(<a href="https://github.com/OSGeo/gdal">https://github.com/OSGeo/gdal</a>) with python bindings. I am<br>> importing GeoJSON to PostgreSQL (PostGIS). I know how to import only<br>> geometry to the table. I dont know how to import geometry with others<br>> columns to one table. I need to import geometry to "wkt_geometry" column<br>> and his name to "name" column.<br>> Can you help me please?<br>> <br>> Here is how I import only geometry column:<br>> * ogr2ogr.main(["", "-f", "PostgreSQL", "-s_srs", * *"+proj=longlat<br>> +datum=WGS84 +no_defs", "-t_srs", "EPSG:3857", "PG:dbname='test'<br>> host='127.0.0.1' port='5432' user='user1' password='password1'", "-nln",<br>> "table1"])*<br>> <br>> Thanks<br>> <br>> Best Regards<br>> Peter<br>> <br>> _______________________________________________<br>> gdal-dev mailing list<br><br>> gdal-dev@.osgeo<br><br>> <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br><br><br><br><br><br>--<br>Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>_______________________________________________<br>gdal-dev mailing list<br><email>gdal-dev@.osgeo</email><br><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></quote><br>
<br>
End of gdal-dev Digest, Vol 203, Issue 38<br>
*****************************************<br>
</blockquote></div></div>