-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Google map tiles #1963
Add Google map tiles #1963
Conversation
🚀 Deployed on https://66513f991de522a8eb819af2--opengeos.netlify.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Thanks, Qiusheng. I've left some minor comments for discussion. Also...
- Whether to add googlemaps as a core dependency
- Whether to add Google Map tiles by default if the environment variable MAPS_API_KEY is detected
These two seem connected. I think we should try to make adding these tiles as easy as possible, which would requires the package be available and fetching stored Maps API key.
The googlemaps package looks a little stale (not much activity on the repo), we should find out what its status is and if the maps team is supporting it. If they are, we should try to get installed in Colab and make sure it is available on Conda-Forge. If maps team is not supporting it, we should discuss what that means.
Looking again, I don't think |
@jdbcode That's great. I was wondering the same thing when implementing it. I have removed it. Will address other comments later today. |
Thanks for removing |
The |
The next step is to add Google Map tiles by default if the environment variable MAPS_API_KEY is detected. The will require making changes to |
Sounds good, thanks for the progress. I'll be at EGU next week, so may not respond right away if you post something. |
I have improved the function. It now supports returning all gmap providers when # returns all gmap providers as a dict when map_type is None, which can be accessed via providers['roadmap'], providers['hybrid']
providers = geemap.google_map_tiles(map_type=None)
# returns a specific gmap provider
geemap.google_map_tiles(map_type='roadmap', language="en-Us", region="US", scale="scaleFactor2x", highDpi=True) |
@naschmitz Good suggestions. I will resolve them this Friday after I return from the conference. |
Sorry for the delay. I have been traveling the past few days. Will resume working on this tomorrow. |
@naschmitz @jdbcode I have implemented all suggested changes. If the Set environment variableimport os
os.environ["MAPS_API_KEY"] = "YOUR_API_KEY" Get a single Google tile providerfrom geemap.basemaps import GoogleMapsTileProvider
GoogleMapsTileProvider(map_type='hybrid') Get all Google tiles as a dictionaryfrom geemap.basemaps import google_map_tiles
google_map_tiles() Use geemap.coreimport geemap.core as geemap
m = geemap.Map()
m import geemap.core as geemap
m = geemap.Map(basemap="Hybrid")
m Use geemapimport geemap
m = geemap.Map()
m.add_basemap("Google.Satellite")
m |
@giswqs - I made a bunch of changes. Mostly removing the dependencies on hardcoded map name prefixes. Please take a look when you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@naschmitz Thank you for making those changes. It looks great to me. I made some minor changes to allow the |
🗺️❤️👏 |
The PR adds a
google_map_tiles()
function for for generating Google Map tiles. To get an API key and enable Map Tiles API, visit https://developers.google.com/maps/get-started#create-project. The API key can be set as an environment variableMAPS_API_KEY
or as a Colab secret.@jdbcode @naschmitz For now, I only add the fucntion to generate the xyzservices.TileProvider. Two more things to discuss:
googlemaps
as a core dependencyMAPS_API_KEY
is detected