Skip to main content

Is it possible to download satellite data from google maps and overlay it with data obtained via S2 using the Python API?


e.g.:


    from io import BytesIO
from PIL import Image
from urllib import request
import matplotlib.pyplot as plt

Saeurig = [14.152730,51.213348, 14.174246,51.198163] # from above (coordinates for Sentinel Hub)
Saeurig_bbox = BBox(bbox=Saeurig, crs=CRS.WGS84)

Saeurig_mid_long = (Saeurig[0] + Saeurig[2]) / 2
Saeurig_mid_lat = (Saeurig[1] + Saeurig[3]) / 2

url = "http://maps.googleapis.com/maps/api/staticmap?center="+str(Saeurig_mid_lat)+","+str(Saeurig_mid_long)+"&size=800x800&zoom=15&sensor=false&maptype=satellite"

buffer = BytesIO(request.urlopen(url).read())
image = Image.open(buffer)
width, height = image.size # getting size of the image

### TEST on evi2 spectra at a specific date for ROI
wms_evi2_request = WmsRequest(layer='EVI2',
bbox=Saeurig_bbox,
time='latest',
width=width, height=height,
instance_id=INSTANCE_ID)
wms_evi2_img = wms_evi2_request.get_data()

plt.imshow(image)
plt.imshow(wms_evi2_img[0], alpha=0.3)
plt.show()

→ However, the images do not match completely (see image):


grafik

According to the TOS you are not allowed to scrape any Google Maps content: https://cloud.google.com/maps-platform/terms/


I believe its projection issue. S2 images are in UTM and Google Image in Web/pseudo Mercator (EPSG:3857). See https://gis.stackexchange.com/questions/48949/epsg-3857-or-4326-for-googlemaps-openstreetmap-and-leaflet


Reply