[Qgis-user] Importing records from both spreadsheet and gpx files

G Fourteener gfourteener at yahoo.com
Thu Sep 12 12:01:00 PDT 2019


Hi Riche,
Thanks! Join (adding the spreadsheet layer from the vector layer, not vice versa) worked. Beforehand, I was able to add a filename column to the layer imported from GPX files using ogr2ogr's sql option (-sql "select *, '$f' as filename from tracks") and then join on that field.
Gerry 

    On Thursday, September 12, 2019, 05:25:20 AM MDT, Richard McDonnell <richard.mcdonnell at opw.ie> wrote:  
 
 #yiv5940039744 #yiv5940039744 -- _filtered #yiv5940039744 {font-family:Helvetica;panose-1:2 11 6 4 2 2 2 2 2 4;} _filtered #yiv5940039744 {font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;} _filtered #yiv5940039744 {panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv5940039744 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv5940039744 #yiv5940039744 p.yiv5940039744MsoNormal, #yiv5940039744 li.yiv5940039744MsoNormal, #yiv5940039744 div.yiv5940039744MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:12.0pt;font-family:New serif;}#yiv5940039744 a:link, #yiv5940039744 span.yiv5940039744MsoHyperlink {color:#0563C1;text-decoration:underline;}#yiv5940039744 a:visited, #yiv5940039744 span.yiv5940039744MsoHyperlinkFollowed {color:#954F72;text-decoration:underline;}#yiv5940039744 p.yiv5940039744MsoListParagraph, #yiv5940039744 li.yiv5940039744MsoListParagraph, #yiv5940039744 div.yiv5940039744MsoListParagraph {margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:36.0pt;margin-bottom:.0001pt;font-size:12.0pt;font-family:New serif;}#yiv5940039744 p.yiv5940039744msonormal0, #yiv5940039744 li.yiv5940039744msonormal0, #yiv5940039744 div.yiv5940039744msonormal0 {margin-right:0cm;margin-left:0cm;font-size:12.0pt;font-family:New serif;}#yiv5940039744 span.yiv5940039744EmailStyle18 {font-family:sans-serif;color:#1F497D;}#yiv5940039744 .yiv5940039744MsoChpDefault {font-size:10.0pt;} _filtered #yiv5940039744 {margin:72.0pt 72.0pt 72.0pt 72.0pt;}#yiv5940039744 div.yiv5940039744WordSection1 {}#yiv5940039744 _filtered #yiv5940039744 {} _filtered #yiv5940039744 {font-family:Symbol;} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {font-family:Wingdings;} _filtered #yiv5940039744 {font-family:Symbol;} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {font-family:Wingdings;} _filtered #yiv5940039744 {font-family:Symbol;} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {font-family:Wingdings;} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {} _filtered #yiv5940039744 {}#yiv5940039744 ol {margin-bottom:0cm;}#yiv5940039744 ul {margin-bottom:0cm;}#yiv5940039744 
Hi Gerry,
 
Apologies, if you’ve already tried these…
 
  
 
If you are only merging columns from a spreadsheet to a Vector Layer, assuming you have a common field, you can merge the data  by:-
 
1.      On theLayers tab, right clicking on the layer and selecting Properties
 
2.      Selecting Joins
 
3.      Click on the Plus sign at the bottom to add Vector Join
 
4.      Set yourJoin Layer (spreadsheet)
 
5.      Join field (common field)
 
6.      The rest of the options are optional, select Ok once you are happy.
 
There you have it spreadsheet fields added to vector using a common field.
 
  
 
Now if you are looking to merge two vector datasets, then form the toolbar select
 
·        Vector
 
·        Data Management Tools
 
·        Merge vector Layers
 
·        AtInput Layers select both layers you want to merge and either clock Run to create a hit the button besideMerged to save to a specific destination
 
  
 
Note this will just merge the datasets using common attributes where possible and adding the rest.
 
  
 
  
 
If you want to format the output, an option I have used before, is to:-
 
1.      In the toolbar selectLayer
 
2.      Create Layer
 
3.      New Temporary Scratch Layer
 
4.      Select your Geometry typeand select OK
 
5.      While still in edit mode click open theAttribute Table
 
6.      Add new fields in the format you require
 
7.      Open the Attribute table of one of the Vector Datasets you want to merge andselect all then go to Edit on the toolbar then select copy features
 
8.      Click highlight the formatted Scratch Layer go toEdit and select Paste Features
 
9.      Go back to the scratch layer attributetable and edit as required
 
10.  Rinse and repeat for the others
 
  
 
Without seeing samples of the data, I cant , unfortunately give you any more help than that.
 
Regards
 
  
 
Riche
 
-- 
 
| 
|  | 
Richard McDonnell
GIS Specialist | FRM Data Management
MSc Geographic Information Systems
  |  |


| 
|  | 
Email:  richard.mcdonnell at opw.ie
  |


  
 
|  | 
Phone:  + 353 (0) 1 647 6543
  |


  
 
|  | 
Mobile:  +353 (0) 87 688 5964
  |



  |  |


  
 
|  |  |  |



  |


  
 
  
 
  
 
  
 
From: Qgis-user <qgis-user-bounces at lists.osgeo.org>On Behalf Of G Fourteener
Sent: 11 September 2019 17:49
To: qgis-user at lists.osgeo.org
Subject: [Qgis-user] Importing records from both spreadsheet and gpx files
 
  
 
Hello,
 
  
 
I've been trying to figure out how to do this...
 
  
 
I have a spreadsheet of records that has a field for the GPX file for each record. I'm able to use ogr2ogr to import the spreadsheet and the GPX files into different layers in a geopackage file. I haven't yet been able to figure out how to combine the two data sources into a single layer, or add a geometry column (and other GPX columns) to the imported spreadsheet layer from the corresponding GPX file. I've also tried using ogrmerge. The GPX layer uses any name within that file (which is different than the filename). I see QGIS has a vector layer merge function, but don't think that will work. Looks like using Python and gdal/ogr modules might work...
 
  
 
The spreadsheet looks like:
 
name, gpx filename, source, date, notes
 
  
 
Thanks,
 
Gerry
 
  
 

Email Disclaimer: http://www.opw.ie/en/disclaimer/  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190912/ec2c58a6/attachment.html>


More information about the Qgis-user mailing list