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

NAIP STAC Item added to map as layer disappears on zoom out, needs a very close zoom level to appear. #661

Closed
rbavery opened this issue Jan 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@rbavery
Copy link

rbavery commented Jan 16, 2024

Environment Information

  • leafmap version: 0.30.1
  • Python version: 3.10
  • Operating System: Ubuntu

Description

I want to zoom out and see my image on the map. But it disappears at far away zoom levels. Also the default zoom level that is set when the map opens won't show the image.

What I Did

import pystac_client
import planetary_computer
from shapely.geometry import Point

area_of_interest = Point((-121.034, 36.990)) # wright solar farm lon lat
catalog = pystac_client.Client.open(
    "https://planetarycomputer.microsoft.com/api/stac/v1",
    modifier=planetary_computer.sign_inplace,
)

range_old = "2010-01-01/2013-01-01"
range_new = "2020-01-01/2021-01-01"

search_old = catalog.search(
    collections=["naip"], intersects=area_of_interest, datetime=range_old
)

search_new = catalog.search(
    collections=["naip"], intersects=area_of_interest, datetime=range_new
)

items_old = search_old.item_collection()
items_new = search_new.item_collection()

print(f"{len(items_old)} Items found in the 'old' range")
print(f"{len(items_new)} Items found in the 'new' range")

map = leafmap.Map()

leafmap.stac_assets(collection="naip", item=items_old[0].id, titiler_endpoint="pc")

m = leafmap.Map()
m.add_stac_layer(
    collection="naip",
    item='ca_m_3612108_ne_10_1_20120622_20120904',
    assets=["image"],
    name="Old image 2012 before solar development",
)
m
@rbavery rbavery added the bug Something isn't working label Jan 16, 2024
@giswqs
Copy link
Member

giswqs commented Jan 17, 2024

Thank you for reporting. I can confirm that I encourter the same issue with NAIP imagery. However, I suspect this is an issue with Planetary Computer rather than leafmap. Check out the example below using Landsat imagery. The layer does not disappear when zoomed out. Leafmap uses the same mechanism to display PC data. If it is indeed a leafmap issue, I would expect both NAIP and Landsat data to experience the same issue. I look into the source code of the stac_tile function, but could not identify any issues that could have caused this.
https://leafmap.org/notebooks/37_planetary_computer/

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