python-visualization / python-visualization/folium
ImageOverlay behaviour with WG84 rasters
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 7.4k
- Forks
- 2.3k
- Merge moyen
- 17 h 22 min
- PR mergées (30 j)
- 11
Description
I have a non-expected result when using this code (the raster used is attached to this message):
raster_path = '2019-06-15.tiff'
with rasterio.open(raster_path) as src:
raster_data = src.read(1)
bounds = src.bounds
m = folium.Map(location=[(bounds.top + bounds.bottom) / 2, (bounds.left + bounds.right) / 2], zoom_start=10)
# Create an ImageOverlay
img_overlay = ImageOverlay(
image=raster_data,
bounds=[[bounds.bottom, bounds.left], [bounds.top, bounds.right]],
opacity=0.6,
interactive=False,
cross_origin=True,
zindex=1,
mercator_project=True
)
# Add the overlay to the map
img_overlay.add_to(m)
m.save('map.html')
Indeed, my result html map presents shapes that are not consistent with the same map I could have just by using QGIS.
For instance the result of this code gives this in a specific region:
while using QGIS in an EPSG:3857 projection system gives this:
My raster has natively an EPSG:4326 projection system. I suspect the issue comes from how ImageOverlay changes the projection system.
Can anyone reproduce this and explain how I could obtain the same result as in QGIS which is the correct reference for me?
Thanks,
Vivien
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par reproduire l’exemple TIFF fourni avec rasterio et folium.ImageOverlay, puis comparez sa gestion de EPSG:4326 avec le résultat EPSG:3857 de QGIS. Examinez le comportement de projection et de bounds de ImageOverlay ainsi que les attentes de Leaflet concernant image-overlay ; le travail est terminé lorsque la divergence est expliquée et que le rendu attendu ou la limitation de l’issue est documenté.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, python
- Domaine
- data-visualization, web-dev
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100