-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
View extent in cartoee module switched up #1958
Comments
Thank you for reporting. Would you like to submit a pull request to fix the issue? |
Basically what happens on my side is that the outline of the districts is mapped correctly. But as soon as I define a Happy to submit a pull request when agreed on the issue. import ee
import matplotlib.pyplot as plt
from geemap import cartoee
FAO_adm_lvl2 = ee.FeatureCollection("FAO/GAUL/2015/level2")
filtered = FAO_adm_lvl2.filter(ee.Filter.And(ee.Filter.inList("ADM2_CODE", [190581, 190568, 190575, 190567, 16578, 16576, 190719, 190720]),
ee.Filter.eq("ADM0_NAME", "Ghana")))
style = {"color": "#000000", "width": 1, "fillColor": "#00000000"}
adm2_outline = ee.Image(filtered.style(**style))
region = [-1.95, 6.4, -1.2, 7.2]
specified_regions_with_centroids = filtered.map(lambda feature: feature.set('centroid', feature.geometry().centroid()))
specified_regions_list = specified_regions_with_centroids.toList(specified_regions_with_centroids.size())
# Iterate over the list to extract geometries and attributes
region_centroids = []
region_names = []
for i in range(specified_regions_list.size().getInfo()):
feature = ee.Feature(specified_regions_list.get(i))
region_centroids.append(dict(feature.get('centroid').getInfo())["coordinates"])
region_names.append(feature.get('ADM2_NAME').getInfo())
fig = plt.figure(figsize=(15, 10))
ax = cartoee.get_map(adm2_outline, region=region)
cartoee.add_gridlines(ax, interval=0.2, xtick_rotation=0, linestyle=":")
for name, centroid in zip(region_names, region_centroids):
plt.annotate(text=name, xy=centroid, fontsize=8, color='red', ha='center')
plt.savefig("view_extent_Kumasi") |
Description
Hej all,
I tried to make a publication map via the cartoee module. In the end, the names of districts were constantly not in the centroid eventhough I just calculated them correctly and double checked correctness. I think I now located a slight switch-up of numbers in the cartoee module. If a
region
is specified as part of theadd_layer()
function theview_extent
is set wrongly. Code is in line 232.Instead of
It should be
Unsure if you need any further info. First bug report :)
The text was updated successfully, but these errors were encountered: