Tip - Using L.imageOverlay with images hosted on Google drive #9212
Jelfff
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Google provides everyone with 15GB of free storage. An image hosted on Google drive can be displayed via L.imageOverlay but there is a trick to it. You need to know how to build the right link. Below are examples of the 3 types of links for an image on Google drive.
Share:
https://drive.google.com/file/d/1LtJWXxoPmxdaDByOiBSHJcuMg_nLXkAo/view?usp=drive_link
Direct - this link can be pasted into a browser bar. But if you use it in L.imageOverlay then you get a CORS error.
https://drive.google.com/uc?export=download&id=1LtJWXxoPmxdaDByOiBSHJcuMg_nLXkAo
Fetch - this link works fine in L.imageOverlay. You need to include your Google API key which has been activated for Google drive.
https://www.googleapis.com/drive/v3/files/1LtJWXxoPmxdaDByOiBSHJcuMg_nLXkAo?alt=media&key=________
Beta Was this translation helpful? Give feedback.
All reactions