如何批量获取多坐标Google Earth航拍及卫星视图截图并自动化?
Hey there! I’ve tackled similar batch mapping screenshot tasks before, so let me walk you through three solid, actionable solutions to automate downloading Google Earth aerial and satellite views for your 500+ coordinates.
This is the official, fastest way to get consistent satellite/aerial imagery—perfect for large batches like yours. The free tier gives you 28,500 monthly requests, which is way more than enough for 500 coordinates (1,000 total requests if you grab both views per coordinate).
Step-by-Step Implementation:
- Get an API Key: Head to Google Cloud Console, enable the Maps Static API, and generate a key (keep this secure!).
- Build the Request URLs:
- Satellite view (pure satellite imagery):
https://maps.googleapis.com/maps/api/staticmap?center=LAT,LNG&zoom=18&size=800x800&maptype=satellite&key=YOUR_API_KEY - Aerial/hybrid view (satellite + road labels, matching Google Earth’s aerial style):
https://maps.googleapis.com/maps/api/staticmap?center=LAT,LNG&zoom=18&size=800x800&maptype=hybrid&key=YOUR_API_KEY
- Satellite view (pure satellite imagery):
- Batch Download with Python:
Use therequestslibrary to loop through your coordinates and save images:import requests # Replace with your details API_KEY = "YOUR_GOOGLE_API_KEY" coordinates = [(37.7749, -122.4194), (40.7128, -74.0060)] # Add all 500+ coordinates here ZOOM_LEVEL = 18 # Adjust for detail (16-20 is ideal for close-up aerial) IMAGE_SIZE = "800x800" for idx, (lat, lng) in enumerate(coordinates): # Download satellite view sat_url = f"https://maps.googleapis.com/maps/api/staticmap?center={lat},{lng}&zoom={ZOOM_LEVEL}&size={IMAGE_SIZE}&maptype=satellite&key={API_KEY}" sat_response = requests.get(sat_url) with open(f"satellite_{idx}.png", "wb") as f: f.write(sat_response.content) # Download aerial/hybrid view aerial_url = f"https://maps.googleapis.com/maps/api/staticmap?center={lat},{lng}&zoom={ZOOM_LEVEL}&size={IMAGE_SIZE}&maptype=hybrid&key={API_KEY}" aerial_response = requests.get(aerial_url) with open(f"aerial_{idx}.png", "wb") as f: f.write(aerial_response.content)
If you don’t want to deal with API keys or limits, use Selenium to simulate a browser navigating Google Earth Web. This mimics manual browsing but automates the process.
Step-by-Step Implementation:
- Install Dependencies:
Then download the ChromeDriver (or your browser’s equivalent) matching your browser version.pip install selenium - Automate Screenshots:
Note: Google Earth’s UI might change, so you may need to update element selectors. Add longer wait times if you hit loading issues, and consider adding random delays to avoid anti-bot detection.from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import time coordinates = [(37.7749, -122.4194), (40.7128, -74.0060)] # Your coordinate list # Initialize Chrome browser driver = webdriver.Chrome() driver.maximize_window() driver.get("https://earth.google.com/web/") time.sleep(5) # Wait for page to load fully for idx, (lat, lng) in enumerate(coordinates): # Search for the coordinate search_box = driver.find_element(By.CSS_SELECTOR, "input.gm-search-input") search_box.clear() search_box.send_keys(f"{lat}, {lng}") search_box.send_keys(Keys.ENTER) time.sleep(3) # Wait for camera to pan to location # Save satellite view screenshot driver.save_screenshot(f"satellite_selenium_{idx}.png") # Optional: Switch to terrain/aerial view (adjust selector if Google updates the UI) # terrain_toggle = driver.find_element(By.XPATH, "//button[@aria-label='Terrain']") # terrain_toggle.click() # time.sleep(2) # driver.save_screenshot(f"aerial_selenium_{idx}.png") driver.quit()
If you want a backup option, Bing’s API works almost identically to Google’s and has generous free limits (125,000 monthly requests).
Quick Implementation:
- Get a Bing Maps API key from the Bing Maps Portal.
- Use these URL templates:
- Aerial view:
https://dev.virtualearth.net/REST/V1/Imagery/Map/Aerial/LAT,LNG/18?mapSize=800,800&key=YOUR_BING_KEY - Aerial with labels:
https://dev.virtualearth.net/REST/V1/Imagery/Map/AerialWithLabels/LAT,LNG/18?mapSize=800,800&key=YOUR_BING_KEY
- Aerial view:
- Reuse the same Python
requestsscript from Option 1—just swap the URL structure.
Final Recommendations:
- Option 1 is best for speed, consistency, and ease of maintenance.
- Use Option 2 only if you can’t use APIs (but be prepared to tweak selectors if Google updates its UI).
- Option 3 is a great fallback if Google’s limits or pricing become an issue.
内容的提问来源于stack exchange,提问作者Gowtham

