Skip to content

add_raster() isn't adding the downloaded image into the map #158

@rafiibnsultan

Description

@rafiibnsultan

So, I was replicating this notebook: https://samgeo.gishub.org/examples/input_prompts/

The code:

import os
import leafmap
from samgeo import SamGeo, tms_to_geotiff

m = leafmap.Map(center=[37.6412, -122.1353], zoom=15, height="800px")
m.add_basemap("SATELLITE")

if m.user_roi is not None:
    bbox = m.user_roi_bounds()
else:
    bbox = [-122.1497, 37.6311, -122.1203, 37.6458]
    
image = "satellite.tif"
tms_to_geotiff(output=image, bbox=bbox, zoom=16, source="Satellite", overwrite=True)

#Display the downloaded image on the map
m.layers[-1].visible = False
**m.add_raster(image, layer_name="Image")**
m

The downloaded image isn't showing up in the map, only the map is being shown while running it on my PC. However, in the google colab it is working fine. Can you suggest what could be the problem?

Output of my PC: https://drive.google.com/file/d/1Ac8r0aXp0u0Wt4GeG7ckG8E79kweb55X/view?usp=drive_link
Output of Colab: https://drive.google.com/file/d/1Ku9QzrowH6FRMc3ursi4NZ4N1bYTs30U/view?usp=drive_link

The author said it could be the localtileserver issue. So, I tried running your example: https://localtileserver.banesullivan.com/
It's not showing up on the map either.

Environment:
localtileserver           0.7.1 
ipyleaflet                0.17.3 
Python version: 3.9.16
Operating System: Ubuntu 22.04.2 LTS

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions