0

Using Fiona for reading my VRT file I'm receiving an error that OGR_VRT driver is not supported:

fiona.errors.DriverError: unsupported driver: 'OGR_VRT'

My test.vrt file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<OGRVRTDataSource>
    <OGRVRTLayer name="test">
        <SrcDataSource>absolute_path_to_test_shp.shp</SrcDataSource>
    </OGRVRTLayer>
</OGRVRTDataSource>

I'm trying to read it using:

>>> import fiona
>>> c = fiona.open('abs_path/test.vrt')

How can Ogr VRT be read by Fiona?

1

Fiona only handles a subset GDAL’s supported drivers:

>>> fiona.supported_drivers
{'AeronavFAA': 'r', 'ARCGEN': 'r', 'BNA': 'raw', 'DXF': 'raw', 'OpenFileGDB': 'r', 'ESRI Shapefile': 'raw', 'GeoJSON': 'rw', 'GPKG': 'rw', 'GPX': 'raw', 'GPSTrackMaker': 'raw', 'Idrisi': 'r', 'MapInfo File': 'raw', 'DGN': 'raw', 'PCIDSK': 'r', 'SEGY': 'r', 'SUA': 'r'}

VRT files are format drivers - they’re used to create geographic datasets, reference geographic datasets, and even specify geometric changes to datasets. But VRT files are not geographic datasets themselves. They’re XML files!

Python’s standard library has plenty of support for processing XML files:
https://docs.python.org/3/library/xml.html

And there are some great 3rd party options too:
xmltodict
untangle

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.