EarthView#
- class EarthView(key: str | None = None, type: str = 'satellite', zoom: int = 18, scale: int = 1, shape: tuple = (500, 500), **kwargs: Any)[source][source]#
Iterate images from GoogleEarth
- Parameters:
key (str) – Google Maps API key, defaults to None (read from the environment, see note below)
type (str, optional) – type of map (API
maptype): ‘satellite’ [default], ‘map’, ‘roads’, ‘hybrid’, and ‘terrain’.zoom (int, optional) – map zoom, defaults to 18
scale (int, optional) – image scale factor: 1 [default] or 2
shape (tuple, optional) – image size (API
size), defaults to (500, 500)kwargs – options applied to image frames, see
convert
The resulting object has a
grabmethod that returnsImageobjects for a specified position on the planet.zoomvaries from 1 (whole world) to a maximum of 18.The
typeargument controls the type of map returned:typeReturned image
"satellite"satellite color image from space
"roadmap"a standard roadmap image as normally shown on the Google Maps website
"map"synonym for
"roadmap""hybrid"hybrid of the satellite with overlay of roadmap image
"terrain"specifies a physical relief map image, showing terrain and vegetation
"roads"a binary image which is an occupancy grid, roads are free space
Example:
from machinevisiontoolbox import EarthView earth = EarthView() # create an Earth viewer image = earth.grab(-27.475722, 153.0285, zoom=17)
Warning
You must have a Google account and a valid key, backed by a credit card, to access this service. Getting started
Note
If
keyis not passed in, it is read from the environment variableGOOGLE_MAPS_API_KEY, or failing that fromGOOGLE_API_KEY. PreferGOOGLE_MAPS_API_KEY: Google’s Gemini libraries also readGOOGLE_API_KEY, so using that name for a Maps key can hand the wrong key to one or the other.Uses the Google Maps Static API. Restrict the key to that API only (Google Cloud console, APIs & Services → Credentials), so a leaked key can’t be used for anything else, and consider a daily request quota to bound costs.
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.1.6.
- Seealso:
grabconvert
Base constructor for image sources.
- Parameters:
kwargs (Any) – source-specific keyword arguments