gee-community/geemap

Distorted Width:Length Ratios in cartoee.get_map() when Visualizing GeoTIFF Files

FeiYao-Edinburgh opened this issue · 3 comments

Environment Information

Please run the following code on your computer and share the output with us so that we can better debug your issue:

import geemap
geemap.Report()

image

Description

I have a publicly available GeoTIFF file and I am able to visualize it with the desired effects in geemap.Map(), but not in cartoee.get_map(), where the width:length ratios appear distorted. I suspect that this might be due to an issue with the projection and have tried modifying the projection parameter without success.

import ee
ee.Initialize()
import geemap
from geemap import cartoee
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
multipass = ee.Image("projects/ee-feiyao/assets/multipass")
m = geemap.Map()
m.centerObject(multipass)
m.addLayer(multipass.select("DeltaXCH4_1723_label_cluster_second"))
m

image

ax = cartoee.get_map(multipass.select("DeltaXCH4_1723_label_cluster_second").visualize(),proj=ccrs.PlateCarree())

image

ax = cartoee.get_map(multipass.select("DeltaXCH4_1723_label_cluster_second").visualize(),proj=ccrs.epsg(3857))

image

ax = cartoee.get_map(multipass.reproject("EPSG:3857", scale=20).select("DeltaXCH4_1723_label_cluster_second").visualize(),proj=ccrs.epsg(3857))

image

giswqs commented

Try something like this:

projection = ccrs.UTM(41)
ax = cartoee.get_map(multipass.select("DeltaXCH4_1723_label_cluster_second").visualize(), proj=projection)
ax.set_extent([left, right, bottom, top])  

Thanks @giswqs

Could you provide more information on how to easily obtain [left, right, bottom, top]?

Btw, manually specifying ccrs.UTM(41) can be inconvenient when trying to find a suitable UTM for different scenes.

giswqs commented

You can draw a rectangle on the map, then use the following to get the coordinates in the format of [xmin, ymin, xmax, ymax]. Note that it is different from the format of [left, right, bottom, top] as required by cartoee.

Map.user_roi_coords()