Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cartoee issue #2003

Closed
caomy7 opened this issue May 6, 2024 · 3 comments
Closed

cartoee issue #2003

caomy7 opened this issue May 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@caomy7
Copy link

caomy7 commented May 6, 2024

Environment Information

geemap = 0.32.0
Cartopy =0.23.0

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

import ee
import geemap
import cartopy.crs as ccrs
# import the cartoee functionality from geemap
from geemap import cartoee
import matplotlib.pyplot as plt


fig = plt.figure(figsize=(10, 8))
# roi = ee.FeatureCollection("users/Molly_HK/daymet_area")

image = crossCorr.clip(roi)

vis = {
  'min': -1,
  'max': 1,
  'palette': ['4AAAF7',"4AE7F7", 'D3D1CD',"FFB833",'FF5B33']

}

ax = cartoee.get_map(crossCorr, region=[-30.0, 0, -180.0, 90], vis_params=vis) #[E,S,W,N]
ax = cartoee.add_colorbar(ax, vis, loc="bottom", label="Correlation", orientation="horizontal")

plt.show()

Description

I want to visualize the image using cartopy.
The image shows OK in the geemap.
It seems to have a problem when I run the above code and get the error as follow:
"HTTPError Traceback (most recent call last)
in <cell line: 21>()
19 }
20
---> 21 ax = cartoee.get_map(crossCorr, region=[-30.0, 0, -180.0, 90], vis_params=vis) #[E,S,W,N]
22 ax = cartoee.add_colorbar(ax, vis, loc="bottom", label="Correlation", orientation="horizontal")
23

1 frames
/usr/local/lib/python3.10/dist-packages/geemap/cartoee.py in add_layer(ax, ee_object, dims, region, cmap, vis_params, **kwargs)
273 if response.status_code != 200:
274 error = eval(response.content)["error"]
--> 275 raise requests.exceptions.HTTPError(f"{error}")
276
277 image = np.array(Image.open(BytesIO(response.content)))

HTTPError: {'code': 500, 'message': 'An internal error has occurred (request: 39097224-ab9e-4b03-a3f2-dbf977d5c506) (computation: "aa777aa76dc125ee590c2b234050d55a")', 'status': 'INTERNAL'}"

What I Did

@caomy7 caomy7 added the bug Something isn't working label May 6, 2024
@caomy7
Copy link
Author

caomy7 commented May 6, 2024

It worked before, but now it doesn't seem to work.

@caomy7
Copy link
Author

caomy7 commented May 7, 2024

how to change the projection from 'crs': 'SR-ORG:6974' to 'crs': 'EPSG:4326'.

@giswqs
Copy link
Member

giswqs commented May 7, 2024

Please a complete script that can reproduce the issue. Incomplete script with undefined variables is not helpful.

Try the following script. If it works, then it is likely your own script problem.

import ee
import geemap
from geemap import cartoee 
import matplotlib.pyplot as plt

geemap.ee_initialize()

# get an image
srtm = ee.Image("CGIAR/SRTM90_V4")

# geospatial region in format [E,S,W,N]
region = [180, -60, -180, 85]  # define bounding box to request data
vis = {"min": 0, "max": 3000}  # define visualization parameters for image

fig = plt.figure(figsize=(15, 10))

# use cartoee to get a map
ax = cartoee.get_map(srtm, region=region, vis_params=vis)

# add a colorbar to the map using the visualization params we passed to the map
cartoee.add_colorbar(ax, vis, loc="bottom", label="Elevation", orientation="horizontal")

# add gridlines to the map at a specified interval
cartoee.add_gridlines(ax, interval=[60, 30], linestyle=":")

# add coastlines using the cartopy api
ax.coastlines(color="red")

plt.show()

@giswqs giswqs changed the title response error: {'code': 500, 'message': 'An internal error has occurred (request: 39097224-ab9e-4b03-a3f2-dbf977d5c506) (computation: "aa777aa76dc125ee590c2b234050d55a")', 'status': 'INTERNAL'} cartoee issue May 7, 2024
@giswqs giswqs closed this as completed May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants