I've been trying to use a ogr2ogr -sql
call to create a ESRI.shp file with the joined attributes - but it keeps on failing due to
"ERROR 1 SELECT from table inshape failed, no such table/feature"
My code is:
ogr2ogr -sql "select inshape.*, joincsv.* from inshape left join 'D:\testfolder\attributes.csv'.joincsv on inshape.ID = joincsv.ID" shape_join.shp D:\testfolder\europe_shapes.shp
The .shp and the .csv may have some ID's that not apear in the other table, I wish to join them so that any .csv IDs that don't exist in the .shp file are droped, while the new colums of .shp IDs that don't exist in the .csv are filled with "NULL".
To be honest I don't quite understand the syntax:
- Why is the .csv source defined within the sql statement while the input .shp and shape_join.shp outside of the SQL statement?
- Is shape_join.shp the output file/ path?