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

leafmap add_raster function can't work in windows #492

Closed
mrpan opened this issue Jul 14, 2023 · 2 comments
Closed

leafmap add_raster function can't work in windows #492

mrpan opened this issue Jul 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mrpan
Copy link

mrpan commented Jul 14, 2023

Environment Information

  • leafmap version:0.22.0
  • Python version:3.9
  • Operating System:windows 10

Description

error:
1019
1020 if http_error_msg:
-> 1021 raise HTTPError(http_error_msg, response=self)
1022
1023 def close(self):

HTTPError: 400 Client Error: BAD REQUEST for url: http://localhost:62933/api/metadata?&filename=D%3A%5Ccode%5Cpy%5Cimages%5CImage10.tif

What I Did

m = leafmap.Map(center=[30.33049401, 104.10887847], zoom=18, height="800px")
m.add_basemap("SATELLITE")
m

image = "D:\\code\\py\\images\\Image10.tif"
tms_to_geotiff(output=image, bbox=bbox, zoom=19, source="Satellite", overwrite=True)

m.layers[-1].visible = False
m.add_raster(image, layer_name="Image")
m
@mrpan mrpan added the bug Something isn't working label Jul 14, 2023
@giswqs
Copy link
Member

giswqs commented Jul 14, 2023

The add_raster function depends on localtileserver. Try it directly without leafmap. If it does not work, report the issue to https://github.com/banesullivan/localtileserver/issues

from localtileserver import get_leaflet_tile_layer, TileClient
from ipyleaflet import Map

# First, create a tile server from local raster file
client = TileClient('path/to/geo.tif')

# Create ipyleaflet tile layer from that server
t = get_leaflet_tile_layer(client)

m = Map(center=client.center(), zoom=client.default_zoom)
m.add_layer(t)
m

@mrpan
Copy link
Author

mrpan commented Jul 17, 2023

Thank you for your answer,I tested this code, maybe localtilsever doesn't support,i report the issue to localtileserver。

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