Closed frafra closed 1 month ago
In the VRT you've provided what is missing is a SrcLayer element in the most nested VRT:
<OGRVRTDataSource>
<OGRVRTLayer name="data">
<SrcDataSource><![CDATA[
<OGRVRTDataSource>
<OGRVRTLayer name="foo">
<SrcDataSource>CSV:measurementorfacts.csv</SrcDataSource>
<SrcLayer>measurementorfacts</SrcLayer> <!-- this is missing -->
<LayerSRS>WGS84</LayerSRS>
</OGRVRTLayer>
</OGRVRTDataSource>]]>
</SrcDataSource>
<SrcSQL>select * from foo</SrcSQL>
<LayerSRS>WGS84</LayerSRS>
</OGRVRTLayer>
</OGRVRTDataSource>
That works, thank you. I have not found that in the documentation.
What is the bug?
I have a VRT file containing a SQL query:`. GDAL is unable to open the resource, as the layer is not found:
<SrcSQL>select * from event join occurrence on occurrence.id=event.id join measurementorfact on measurementorfact.id=event.id</SrcSQL>
.measurementorfact
refers to aOGRVRTLayer`` with the same name:
The file is named
measurementorfacts.txt
while the layer is namedmeasurementorfact
, without the additionals
letter and the file extension.Renaming the layer to
measurementorfacts
(matching the filename without the extension, by adding the additionals
) fixes the issue, but then what is the meaning of having a mandatoryname
attribute forOGRVRTLayer
?Even stranger, is that changing the
name
attribute to a random string, produces a different error:Steps to reproduce the issue
Here is a smaller code example to reproduce the issue:
test.vrt
:measurementorfacts.csv
:Versions and provenance
GDAL 3.8.4, released 2024/02/08 from Nix repositories. GDAL 3.8.3, released 2024/01/04 on openSUSE Leap 15.6.
Additional context
No response