EarthView: read key from GOOGLE_MAPS_API_KEY to avoid clash with Gemini's GOOGLE_API_KEY
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- computer-vision
Research direction
Review Sources.py and EarthView.__init__, then run the TestEarthViewKey tests in tests/test_image_sources.py. The issue says the change is already implemented on fix/earthview-maps-key-env; rebase on main if needed, open a PR, and check the RVC3 text and notebooks for instructions that still recommend GOOGLE_API_KEY. Done means the PR is opened and those instructions are updated where necessary.
Written by the indexing model from the issue text.
Description
EarthView reads its Google Maps key only from the GOOGLE_API_KEY environment variable (Sources.py, EarthView.__init__). That is also the first name Google's Gemini libraries (google-genai) check, so anyone with both a Maps key and a Gemini key can only satisfy one of them: whichever key is in GOOGLE_API_KEY, the other tool gets the wrong one.
Proposed fix
Read GOOGLE_MAPS_API_KEY first, falling back to GOOGLE_API_KEY so existing setups keep working:
self.key = os.getenv("GOOGLE_MAPS_API_KEY") or os.getenv("GOOGLE_API_KEY")
and update the docstring to explain the lookup order, recommend GOOGLE_MAPS_API_KEY, and advise restricting the key to the Maps Static API with a daily quota (an unrestricted Maps key that leaks can run up charges).
Status
Implemented and tested on branch fix/earthview-maps-key-env (commit 4e12d1b), not yet opened as a PR:
EarthView.__init__lookup changed as above, docstring updated- 4 new tests in
tests/test_image_sources.py(TestEarthViewKey): Maps key preferred,GOOGLE_API_KEYfallback, explicitkey=wins, no key givesNone; no network access needed tests/test_image_sources.pypasses (13 passed, 20 skipped for optional extras) in a clean venv
Possible follow-up
With no key at all, self.key is None and the failure only shows up later as an HTTP error from Google. A clear error at construction time (or on first grab) naming both environment variables would be friendlier.
To finish
Open a PR from the branch (rebase on main first if it has moved), and update the RVC3 text/notebooks if they tell readers to set GOOGLE_API_KEY.
- Dominant language
- Python
- Stars
- 223
- Forks
- 30
- Avg merge
- 1h 4m
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from petercorke/machinevision-toolbox-python
-
tech-debt
Difficulty 5/5 Over a week Newbie friendliness 25/100
petercorke/machinevision-toolbox-python#122 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 5/5 Over a week Newbie friendliness 25/100
petercorke/machinevision-toolbox-python#119 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 5/5 Over a week Newbie friendliness 30/100
petercorke/machinevision-toolbox-python#117 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 5/5 Over a week Newbie friendliness 45/100
petercorke/machinevision-toolbox-python#115 ·
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 4/5 3-5 days Newbie friendliness 62/100
petercorke/machinevision-toolbox-python#113 ·
Maintainers usually reply within 1 day
All issues in petercorke/machinevision-toolbox-python
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Harmony OPeNDAP SubSetter (HOSS) Geographic LARC_CLOUD PREFIRE_SAT2_AUX-SAT R01 production
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nasa/harmony-autotester#245 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/imod-python#1928 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100