I have a raster file on a google cloud storage bucket and I want to open it with GDAL. I am trying this:

from osgeo import gdal
from google.cloud import storage
from google.cloud import client

#ensure file exists
name = '1.tif'
storage_client = storage.Client()
bucket_name = 'my-bucket'
bucket = storage_client.bucket(bucket_name)
stats = storage.Blob(bucket=bucket, name=name).exists(storage_client)

This returns True and the full path is gs://my-bucket/1.tif

But when I do this


it returns None

I can open the file correctly just fine when I read it from my google drive, so this seems to be an issue only on google cloud storage


1 Answer 1


GCS buckets are implemented as a GDAL virtual filesystem, so you'll want to update the filepath to:


But as @Kartograaf mentions, you may also need to set some additional configuration parameters if your bucket requires authentication.

Alternatively, rasterio appears to handle the gs:// notation.

  • 3
    Thanks, @James. In case it's useful to others, I found the configuration parameters for authentication here: gdal.org/user/… Commented Sep 19, 2022 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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