2

GDAL 2.2.4 (64bit Windows) throws an error during opening of a cyclic OGRVRT file.

There was no problem with cyclic VRTs in GDAL 1.10.1 (32bit Windows).

Here is a sample VRT file, which I used to join an ORACLE table with a MSSQL table:

<!-- file: myJoin.ovf -->
<OGRVRTDataSource>
    <OGRVRTLayer name="mssql">
        <SrcDataSource relativeToVRT="1">mssql.ovf</SrcDataSource>
        <GeometryType>wkbNone</GeometryType>
        <SrcSQL>SELECT * from mssql</SrcSQL>
    </OGRVRTLayer>
    <OGRVRTLayer name="oracle">
        <SrcDataSource relativeToVRT="1">oracle.ovf</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <SrcLayer>oracle</SrcLayer>
    </OGRVRTLayer>
    <OGRVRTLayer name="myJoin">
        <SrcDataSource relativeToVRT="1">myJoin.ovf</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <SrcSQL dialect="sqlite">
        SELECT o.*,m.ui_status from oracle o left join mssql m on o.uwi = m.ui
        </SrcSQL>
    </OGRVRTLayer>
</OGRVRTDataSource>

ogrinfo (GDAL 2.2.4) throws an error:

D:\data>ogrinfo -ro myJoin.ovf
INFO: Open of `myJoin.ovf'
      using driver `OGR_VRT' successful.
1: MSSQL (None)
2: ORACLE (Point)
3: MYJOINERROR 1: Cyclic VRT opening detected !
 (None)

Is there any mechanism/flag, that prevents the "Cyclic VRT" detection and allows to use cyclic VRT files again?

1

Possibly this feature was removed as part of a security fix in GDAL 2.2.2 ~ https://trac.osgeo.org/gdal/wiki/Release/2.2.2-News (OGR_VRT: avoid crash on cyclic VRT).

For those looking at an alternative method, you can chain together your VRT datasources like below:

<!-- file: myJoinSources.ovf -->
<OGRVRTDataSource>
    <OGRVRTLayer name="mssql">
        <SrcDataSource relativeToVRT="1">mssql.ovf</SrcDataSource>
        <GeometryType>wkbNone</GeometryType>
        <SrcSQL>SELECT * from mssql</SrcSQL>
    </OGRVRTLayer>
    <OGRVRTLayer name="oracle">
        <SrcDataSource relativeToVRT="1">oracle.ovf</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <SrcLayer>oracle</SrcLayer>
    </OGRVRTLayer>
</OGRVRTDataSource>

<!-- file: myJoin.ovf -->
<OGRVRTDataSource>
    <OGRVRTLayer name="myJoin">
        <SrcDataSource relativeToVRT="1">myJoinSources.ovf</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <SrcSQL dialect="sqlite">
        SELECT o.*,m.ui_status from oracle o left join mssql m on o.uwi = m.ui
        </SrcSQL>
    </OGRVRTLayer>
</OGRVRTDataSource>
  • That‘s the workaround I already know. But sorry, this was not the question. – christoph Jul 22 at 19:29
  • @christoph for a definitve answer you'd probably be better off contacting the developers directly, or posting an issue ~ github.com/OSGeo/gdal/issues – nmtoken Jul 22 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.