How to Access GIS Data Directly From Google Drive with QGIS


Google Drive is a popular data sharing platform from Google. I have been using it for many years to keep some data in particular the data that I want to share with others. I'm sure that many people also using Google Drive out there including you. There are many kinds of data that can be stored in Google Drive like document, image, music, and many more including GIS data. If we want to share the data, simply it can be done in the sharing option to get a sharing link and then we send the link to other people which allow him/her to access the data.
 
When having a sharing link, one can open a shared folder to view and download data. For document like word, spreadsheet, pdf and image, it is possible to preview it before downloading to a local machine. What about GIS data? Can we preview it, to see how it looks like before saving it to a local machine? Unfortunately for GIS data, it's not possible to do that. Then if we can't preview it, can we open it directly from Google Drive with a GIS software? I think it's an interesting question, cause by opening directly a GIS data from Google Drive with a GIS software, not only to view it, we can also play with the data. With this capability, will make GIS data sharing more convenient. 
 
In this tutorial I will explain step by step how to access a GIS data both vector and raster directly from Google Drive with QGIS software. For this tutorial I'm using QGIS 3.x.

Access GIS Vector Data From Google Drive

To do vector data sharing through Google drive, we are using vector data in geojson format. If your data in another format, convert it into geojson. It can be done easily in QGIS with the following steps:
1. Add the data into QGIS map canvas.
2. From it's layer name, right click and select Export then Save Feature As... as shown in figure 1.
 
Export Data QGIS
Figure 1. Save/Export data into another format in QGIS

3. The Save Vector Layer as... window will be shown as in figure 2. In the Format option select  GeoJSON and in the File name, specify the output path and also the name of output file. If you want to change the coordinate system, define it in CRS option.

Export data into geojson
Figure 2. Export/Save data into GeoJSON

Upload the data into Google drive. Then set the sharing option for the file. Right click the file in the google drive and select Share as seen in figure 3. 

Share a file in Google Drive
Figure 3. Share a file in Google Drive

Under Get Link part, click Change. The Get link menu will appear as in figure 4. Select Anyone with the link and set is as Viewer. Based on the sharing setting, a sharing link will be created. Copy it by selecting Copy link.

Change file sharing option
Figure 4. Change file sharing option

The sharing link will be look as follow:

https://drive.google.com/file/d/1JR1drXAQRMDDS0FMSMIGCT20-ufhz2O8/view?usp=sharing

We already have a sharing link, but we can't use it to access the shared data in QGIS. We have to modify it a little bit to be like the following format. Be careful not to to change the red highlighted text. Because that is the file ID and it's unique for each file.

https://drive.google.com/uc?id=1JR1drXAQRMDDS0FMSMIGCT20-ufhz2O8&export?format=geojson

Now let's try to open the shared data in Google drive with QGIS. Select Data Source Manager, and choose Vector on the left menu. In the Source Type option select Protocol: HTTP(S), cloud, etc. Under Protocol select GeoJSON for Type and in the URI fill in with the modified google drive sharing link. Finally push Add button. See figure 5.

Open GeoJSON data from Google Drive
Figure 5. Open GeoJSON data from Google Drive  

QGIS will fetch the remote file in Google drive depends on internet speed and the file size. When it done the file will be added into map canvas as in figure 6.

GeoJSON data from Google Drive added into QGIS map canvas
Figure 6. GeoJSON data from Google Drive added into QGIS map canvas

Open GIS Raster Data From Google Drive

After opening directly a vector data from Google drive. Now let's try to open raster data. The main steps are the same with the previous step. Here we need to upload a raster data in geotiff format into google drive and set and modify the sharing link to be as follow.

https://drive.google.com/uc?id=117NzcFlcy-NGB4enu4O8DINNZ2e34TQL&export?format=tif

Open Data Source Manager again. Now select Raster, then choose Protocol: HTTP(S), cloud, etc. Under the Protocol, select HTTP/HTTPS/FTP in the Type option and in URI parameter fill in with the modified raster sharing link as in figure 7.

Open Raster data from Google Drive
Figure 7. Open Raster data from Google Drive

After pushing the Add button, the raster data from Google drive will be added into QGIS map canvas as in seen in figure 8.
 
Geotiff data from Google Drive added into QGIS map canvas
Figure 8. Geotiff data from Google Drive added into QGIS map canvas
 
If you notice the shared link, it is too long and difficult to remember. Furthermore the returned layer name also like the long shared link begin with uc?id=..... as seen in figure 6 or 8. We want something shorter and easy to remember. For this, we can use a link shortener service like bit.ly. Using the link shortening service I change the link to http://bit.ly/street_geojson for vector data and http://bit.ly/ndvi_image for raster. Now it is shorter and easy to remember, isn't it?

That's all how to access GIS data directly from Google drive with QGIS. With this capability we can share GIS data with a link to other people and he/she can open it directly from QGIS. If you are working remotely in a team or having an online GIS course, now Google drive would be your GIS data provider. Thanks for reading!
 
Watch the video tutorial!

Related Posts

Disqus Comments