Useful Tip: Copy-Paste Geometry from QGIS to PostGIS

Did you know (I just found out) that when you copy some rows from your attribute table in QGIS and paste that into a Query window in PostgreSQL, the geometry of your object is passed as WKT geometry?

Try this:

Open QGIS, select some geometries and copy the selected rows to the clipboard (Ctrl-C or by using the Select button in the Attribute table window)


Then, open PostgreSQL, open a Query window and paste your data:


The first column is your geometry in Well-Known Text!

Could be uber useful and easy after that to simply use this geometry description in association with ST_GeometryFromText to perform many type of analysis (like using those polygons to perform an Intersect) without the need to import your data into PostGIS…

Just thought you’d be interested to know! :)

This entry was posted in GIS, PostGIS and tagged , , . Bookmark the permalink.