microsoft / PlanetaryComputer

Issues, discussions, and information about the Microsoft Planetary Computer
https://planetarycomputer.microsoft.com/
MIT License
178 stars 7 forks source link

Reading Data from the STAC API - does not work if you follow the instructions exactly #345

Open douglasmacdonald opened 3 months ago

douglasmacdonald commented 3 months ago

With reference to the following link

https://planetarycomputer.microsoft.com/docs/quickstarts/reading-stac/

Issue 1

The following does not explain why pip is used and not mamba as previously recommended.

python -m pip install pystac-client.

Plus, there is no mention of installing planetary_computer.

import pystac_client
import planetary_computer

catalog = pystac_client.Client.open(
    "https://planetarycomputer.microsoft.com/api/stac/v1",
    modifier=planetary_computer.sign_inplace,
)

Error

ModuleNotFoundError                       Traceback (most recent call last)
      1 import pystac_client
----> 2 import planetary_computer
      4 catalog = pystac_client.Client.open(
      5     "https://planetarycomputer.microsoft.com/api/stac/v1",
      6     modifier=planetary_computer.sign_inplace,
      7 )

ModuleNotFoundError: No module named 'planetary_computer'

Solution

I can't comment as I don't know if you want to use pip or mamba.

Issue 2

time_range = "2020-12-01/2020-12-31"
bbox = [-122.2751, 47.5469, -121.9613, 47.7458]

search = catalog.search(collections=["landsat-c2-l2"], bbox=bbox, datetime=time_range)
items = search.get_all_items()
len(items)

Warning

FutureWarning: get_all_items() is deprecated, use item_collection() instead.

Issue 3

Another pip/mamba install is missing from the text.

import contextily

ModuleNotFoundError: No module named 'contextily'

Solution

Again, I don't know if you want to use mamba or pip.

TomAugspurger commented 3 months ago

Thanks for opening the issue. We can update the first snippet to recommend installing both pystac-client & planetary-computer.

I'll hold off on adding contextily, since that isn't strictly necessary for core features being shown there.

I don't know if you want to use mamba or pip.

That would be up to the user.