How to add data from Google Drive to AGOL notebook

1482
7
Jump to solution
04-06-2021 11:02 PM
KyawNaingWin
New Contributor II

I have problem uploading my imagechips as zip into notebook for model training. It failed uploading. Maybe it was due to slow internet connection (or something else).

Since I do not find any module/scripts to attach drive to AGOL notebook (as in colab and kaggel), I was thinking to download the zip from my google drive. I enable the sharing option of zip file with "Anyone with the link can download".

I tried

! wget "https://drive.google.com/file/d/10x6q4DOWD60d5SA1WC2V_JKEvI2z1zV3/view?usp=sharing"

But I got nothing except view?usp=sharing in the notebook folder. When I click it gives "

404 : Not Found

You are requesting a page that does not exist!"

 

Is there any way to download data from Google Drive to AGOL notebook?

Since Google drive can sync files from desktop, it is stress-free option to upload large file with bad connection.

 

0 Kudos
1 Solution

Accepted Solutions
KyawNaingWin
New Contributor II

Yesterday I was playing  around with AGOL notebooks and under Advance runtime with GPU, there I noticed a module called "googledrivedownloader". With a little bit of digging I found how to use it to get my zip data from Google Drive to AGOL notebook file space.

This module is not preinstalled in standard runtime. So you need to pip-install it.

#https://pypi.org/project/googledrivedownloader/
#https://github.com/ndrplz/google-drive-downloader


from google_drive_downloader import GoogleDriveDownloader as gdd


#publick link - https://drive.google.com/file/d/13Mgt7Q2SQou5kik6PAahLBgbt771Gzle/view?usp=sharing


gdd.download_file_from_google_drive(file_id='13Mgt7Q2SQou5kik6PAahLBgbt771Gzle',
dest_path='/arcgis/home/gdd.zip',
unzip=True)

View solution in original post

0 Kudos
7 Replies
DanPatterson
MVP Esteemed Contributor

If you search the Esri Community, there are many related links about using Google Drive.

How To: Use Google Drive photos in ArcGIS Online pop-ups (esri.com)

It has something about specifying the actual image name.  The link is about popups but others links are more generic


... sort of retired...
0 Kudos
CalbePetre
New Contributor

I am also facing the same error and this link is not helping. any other solution?

0 Kudos
DanPatterson
MVP Esteemed Contributor

There were many other links about Google Drive usage... my link was only one example.  Perhaps one of the others may match your user case.


... sort of retired...
0 Kudos
KyawNaingWin
New Contributor II

Dear DanPatterson

there are about 400 images (448 x 448 size) in the zip file that I need to read into the python code to further train a deep learning model.

Pop-up is usually part of the webmap and thus I cannot use it in my case

0 Kudos
KyawNaingWin
New Contributor II

At the moment, the work around is to upload the zip to my GitHub and from there I can get a link to fetch the zip via ! wget "https://github.com/youracc/yourrepository/raw/main/your.zip"

Since GitHub limits the file size to 100Mb, I have to use GitHub's Large File Storage (LFS) option to upload my zip which is about 250Mb. After setting up github lfs on my desktop, I could upload the zip via GitHub desktop application as the same way as other files I used to upload.

Doc of Github lfs link

0 Kudos
MarkKinnaman
New Contributor III

You will have to use Google's API to download the file.

Python API to Download File 

Google API Quickstart 

0 Kudos
KyawNaingWin
New Contributor II

Yesterday I was playing  around with AGOL notebooks and under Advance runtime with GPU, there I noticed a module called "googledrivedownloader". With a little bit of digging I found how to use it to get my zip data from Google Drive to AGOL notebook file space.

This module is not preinstalled in standard runtime. So you need to pip-install it.

#https://pypi.org/project/googledrivedownloader/
#https://github.com/ndrplz/google-drive-downloader


from google_drive_downloader import GoogleDriveDownloader as gdd


#publick link - https://drive.google.com/file/d/13Mgt7Q2SQou5kik6PAahLBgbt771Gzle/view?usp=sharing


gdd.download_file_from_google_drive(file_id='13Mgt7Q2SQou5kik6PAahLBgbt771Gzle',
dest_path='/arcgis/home/gdd.zip',
unzip=True)

0 Kudos