Here's what I'm trying to achieve:
- Load the required GIS layer (*.shp file)
- Load the .csv file in QGIS
- Perform the join based on common attributes in the two files
- Export the mapped .csv file as a .shp file
This is where I'm having trouble. The error that I'm getting is
"Invalid Data Source: C:/GIS Projects/Services.shp is not a valid or recognized data source"
I am so used to doing this easily in ArcGIS and MapInfo I don't understand why I cannot get this to work on QGIS. I have write permissions and everything and I can see 3/4 files being created in the specified folder just the .shp file is missing in the output folder.
Answer
You don't want to export csv, you should Save as... the shapefile which you joined the csv to. If you export csv table (which was not loaded with points geometry), there won't be any geometry and thus no shapefile.
So it should go like this:
- drag and drop shapefile and csv into QGIS
- Double click on shapefile in layers list, switch to joins tab
- join csv to shapefile table through common attribute
- right click on shapefile and Open attribute table to make sure it is joined as expected (now actually this might cause potentionally troubles because shapefiles/respectively dbf tables have only 10 characters limitation for column names and also limit for absolute length - good idea is rename csv to some very short name - only one character or so before starting the whole operation, or use the custom field name prefix when doing join)
- once all look good right click and Save as... on shapefile, by default QGIS will automatically load the new file after save
- If you want to save only features with joined information from csv - meaning your csv has IDs only of some smaller subset of features:
- Select only the ones joined through expression: "joined_column_name" is not NULL
- Then click on Save as... and check Save only selected features
(If you try to save csv it will create only dbf (and projection files proj, qpj)) but won't create shapefile because csv is only table, which can be joined to shapefile but not the other way around - thus it will come up with error because there won't be any shp to load)
No comments:
Post a Comment