I have some understanding problems regarding the geemap and ee in python environment. What I want to do is quite simple : do some measurements with the image of a map (area calculation).
So what I have coded now :
What I don't achieve :
The code :
` Map = geemap.Map()
lat = 48.858370
lon = 2.294481
Map.set_center(lat=lat, lon=lon, zoom=18)
point = ee.Geometry.Point(lon, lat)
feature = ee.Feature(point)
# Map.view_mode = 'HYBRID'
Map.add_basemap('SATELLITE')
Map.add_ee_layer(feature)
scale = Map.get_scale()
print("Scale : " + str(scale) + " m/pixel")
download_dir = os.path.join(os.path.expanduser('~'), 'Documents')
png_file = os.path.join(download_dir, 'my_map.png')
image = Map.to_image()
# image = Map.to_image()
# print(image)
Map
`
The image generated is a simple screenshot that I don't want because I specifically want the map in PNG (or other). I also understood that there is the Google Maps Static API but it does include billing etc which I don't want because it is a small personal project (no lucrative)
I tried a lot of things but it doesn't work as I want : the satellite view as you can see in the image.Output Map
In a perfect way, I want to define a centered rectangle around the lat,lon to extract the image. I tried the collection but the resolution is really bad so maybe I don't use it in the good way.
` lat = 48.858370 lon = 2.294481
image_size = 1000
roi = ee.Geometry.Point(lon, lat).buffer(image_size/2).bounds()
collection = ee.ImageCollection('COPERNICUS/S2')
image = collection.filterBounds(roi).first()
clipped_image = image.clip(roi)
url = clipped_image.getThumbURL({'min': 0, 'max': 3000, 'dimensions': 1000})
Image(url=url)
`
The output is really bad so I think I don't use really good even if I change COPERNICUS to other collection (LANDSAT etc) enter image description here
I didn't find an answer using earth engine. Instead I use the Google Maps API Static, you can use it for free if you don't exceed the minimum charged requests.