I am trying to intersect Spatialite datasets with ogr2ogr, the OGR Virtual Format and SQL Syntax. I can't seem to locate whether the error is in my SQL query or my VRT file.
rice_temperature.sqlite | Spatialite database containing 1 layer "rice_temp"
rice_elevation.sqlite | Spatialite database containing 1 layer "rice_elev"
<OGRVRTDataSource> <OGRVRTLayer name="temperature"> <SrcDataSource>rice_temperature.sqlite</SrcDataSource> </OGRVRTLayer> <OGRVRTLayer name="elevation"> <SrcDataSource>rice_elevation.sqlite</SrcDataSource> </OGRVRTLayer>
All in the same directory I am also executing ogr2ogr from.
ogr2ogr -f "ESRI Shapefile" intersection.shp rice_vectors.vrt -dialect sqlite -sql "SELECT ST_Intersection(rice_temperature.geometry,rice_elevation.geometry) AS geometry FROM rice_temp,rice_elev"
I tried a number of variations to the VRT file as well as to the SQL query itself. All errors are either no such table: rice temp or Cannot open datasource 'rice_elevation'
I have a feeling that I am close but can't wrap my head around what I am doing wrong - is it the SQL query or my use of OGRs Virtual Format?