python-visualization / python-visualization/folium

ImageOverlay behaviour with WG84 rasters

Aperta
#2,054 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
7.4k
Fork
2.3k
Merge medio
17h 22m
PR unite (30g)
11

Descrizione

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:
image

while using QGIS in an EPSG:3857 projection system gives this:
image

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

2019-06-15.zip

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l'esempio TIFF fornito con rasterio e folium.ImageOverlay, quindi confronta la sua gestione di EPSG:4326 con il risultato EPSG:3857 di QGIS. Leggi il comportamento di proiezione e bounds di ImageOverlay insieme alle aspettative di Leaflet per image-overlay; il lavoro è completato quando la discrepanza è spiegata e il rendering previsto o la limitazione dell'issue è documentata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, python
Ambito
data-visualization, web-dev
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.