[Qgis-user] Exporting, processing and re-importing

Thayer Young thayeray at yahoo.com
Tue Nov 8 06:26:18 PST 2022


 Hi Magnus,
This is the correct place for asking your questions.
If you have a unique identifier you can join your altered Excel file to your original geometry file. From the Layer Properties of the layer with geometry choose "Joins" and click the green plus sign in the bottom left. Then choose the Excel file and the unique ID that will create the match between both files. You can see the results from the attribute table of the geometry file. This will be similar to a left join, showing nulls for rows that do not join to the geometry. Once you have the join 

If that doesn't work, the easiest is to export as a CSV with the geometry. If your geometry is more than points, under the Layer Options I recommend exporting GEOMETRY "AS_WKT" (well known text, wikipedia has a good explanation). After making your changes, you will then import the file using the Delimited Text setting in Data Source Manager.

My understanding is that there is not a database running in the background, but QGIS does use SpatiaLite syntax for doing expressions, etc..

As you are good with SQL, I would recommend that you move your data into a spatial database, e.g. PostgreSQL with PostGIS extension or SQLite with SpatiaLite (single file database). After installing the software you would create a database, and create the spatial extension in the database from the command line (see the directions on PostGIS.net, etc.). Then in QGIS you can connect to the database from the "Browser" panel for the type of database you created. You can then use the "Database Manager" in QGIS to import the data, or shp2pgsql etc.. You can also use Database Manager to query the data and add those queries to the map, just remember to have a unique ID and a geometry column.   

If you need further help with any of this please write back to the listserve. 
The documentation can be found here if you want more detail than I have provided:https://docs.qgis.org/3.28/en/docs/user_manual/
-Thayer

  
 > Date: Sun, 6 Nov 2022 20:22:36 +0100
> From: Magnus MacHale-Gunnarsson <mejl at magnusgunnarsson.se>
> To: Qgis-user at lists.osgeo.org
> Subject: [Qgis-user] Exporting, processing and re-importing
> Message-ID: <25397FD7-1812-4344-8FE3-03E8A5DB1E48 at magnusgunnarsson.se>
> Content-Type: text/plain;    charset=utf-8
> 
> Hello.
> 
> (I?m not at all certain this is the right forum for this question, so apologies if it isn?t and please point me to a better forum.)
> 
> I?m using QGIS 3.26.6 Buenos Aires on MacOS Ventura 13.0.
> 
>I have a layer with lots of shapes, and I need to add a field or two, to some of the objects. I could do that in QGIS, but the interface is awkward if you have a few hundred objects to go through, so I?d like to export the data, group and filter as I like, and then re-import the processed file into QGIS.
> 
>1. Can I export just the attributes table, do the processing, and reimport? If so, how  do I connect the reimported attributes to the objects? Will the reimported attributes table clash with the existing one?
> 
> 2. Or is it better to export the attributes WITH the coordinates? Which format is suitable for that? (I find row-based formats like csv or Excel easiest, but that is not too important.) I tried exporting to Excel, with ?Geometry? checked, but when I tried to re-import that file again the coordinates were not included.
> 
> 3. I understand there is a relational database in the background. I?m very used to SQL. Is it better to work directly with that database, and not worry about importing and exporting? How do I access it?
> 
>   MagnusMG

  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20221108/ef853c75/attachment.htm>


More information about the Qgis-user mailing list