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

Error adding basemap to Lonboard Map #798

Closed
spatialthoughts opened this issue Jun 30, 2024 · 5 comments · Fixed by #799
Closed

Error adding basemap to Lonboard Map #798

spatialthoughts opened this issue Jun 30, 2024 · 5 comments · Fixed by #799
Labels
bug Something isn't working

Comments

@spatialthoughts
Copy link
Contributor

Environment Information

  • leafmap version: 0.35
  • Python version: 3.10
  • Operating System: Colab (Ubuntu)

Description

import leafmap.deckgl as leafmap
from lonboard import basemap

m = leafmap.Map(height=600, basemap_style=basemap.CartoBasemap.DarkMatterNoLabels)
m

This results in an error TypeError: ViewState.new() got an unexpected keyword argument 'basemap_style'.

Diving into the code, this seems to be because the kwargs are passed on to view_state and not lonboard.Map

        super().__init__(
            _height=height,
            show_tooltip=show_tooltip,
            layers=layers,
            view_state=kwargs,
        )
@spatialthoughts spatialthoughts added the bug Something isn't working label Jun 30, 2024
@giswqs
Copy link
Member

giswqs commented Jun 30, 2024

Try this:

import leafmap.deckgl as leafmap
from lonboard import basemap

m = leafmap.Map(height=600)
m.add_basemap("CartoDB.DarkMatterNoLabels")
m

@spatialthoughts
Copy link
Contributor Author

This gives AttributeError: 'Map' object has no attribute 'add_basemap' error

Reproducible example on Colab
https://colab.research.google.com/drive/1TEG2_7WEUwkcfoKb4zxx2NE5P8OYdfuz?usp=sharing

@giswqs
Copy link
Member

giswqs commented Jun 30, 2024

Thank you for report. It has been fixed in #799. Please update it to v0.35.1

import leafmap.deckgl as leafmap
from lonboard import basemap

m = leafmap.Map(height=600, basemap_style=basemap.CartoBasemap.DarkMatterNoLabels)
m

image

@spatialthoughts
Copy link
Contributor Author

Incredible! Less than 2 hours from bug report to fix to release. Upgraded and uses it to create the visualization I was after.

lonboard_rivers

@giswqs
Copy link
Member

giswqs commented Jun 30, 2024

My pleasure. That was an easy fix. I should improve the lonboard module when I have time. There is still a lot of room for improvement.

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

Successfully merging a pull request may close this issue.

2 participants