I am writing a script using the GDAL/OGR Python bindings and it is possible that the user may provide a raster dataset or a vector dataset as input. If the user provides a vector dataset, the script will convert it to raster.
Is there a way to determine whether the dataset is raster or vector before opening them?
I could just try to open the dataset with OGR first and if it returns None I could try to open with GDAL, but I am looking for a more simple way like
gdal.IsRaster(filepath) if it exists.