3434 """
3535)
3636
37- # Create input field for the query
38- query = st .text_input (
39- "Enter your query" ,
40- placeholder = "Find imagery over Paris from 2017" ,
41- help = "Describe what kind of satellite imagery you're looking for" ,
42- )
37+ # Create two columns for query and catalog URL
38+ col1 , col2 = st .columns ([3 , 1 ])
4339
44- # Add a search button
45- search_button = st .button ("Search" )
40+ with col1 :
41+ # Create input field for the query
42+ query = st .text_input (
43+ "Enter your query" ,
44+ placeholder = "Find imagery over Paris from 2017" ,
45+ help = "Describe what kind of satellite imagery you're looking for" ,
46+ )
47+ # Add a search button
48+ search_button = st .button ("Search" )
4649
50+ with col2 :
51+ # Define catalog options
52+ catalog_options = {
53+ "Planetary Computer" : "https://planetarycomputer.microsoft.com/api/stac/v1" ,
54+ "VEDA" : "https://openveda.cloud/api/stac" ,
55+ "E84 Earth Search" : "https://earth-search.aws.element84.com/v1" ,
56+ "DevSeed EOAPI.dev" : "https://stac.eoapi.dev" ,
57+ "Custom URL" : "custom" ,
58+ }
4759
48- # Function to run the search asynchronously
49- async def run_search (query ):
50- response = requests .post (
51- f"{ API_URL } /items/search" , json = {"query" : query , "limit" : 10 }
60+ # Create dropdown for catalog selection
61+ selected_catalog = st .selectbox (
62+ "Select STAC Catalog" ,
63+ options = list (catalog_options .keys ()),
64+ index = 0 , # Default to Planetary Computer
65+ help = "Choose a predefined STAC catalog or select 'Custom URL' to enter your own." ,
5266 )
67+
68+ # Handle custom URL input
69+ if selected_catalog == "Custom URL" :
70+ catalog_url = st .text_input (
71+ "Enter Custom Catalog URL" ,
72+ placeholder = "https://your-catalog.com/stac/v1" ,
73+ help = "Enter the URL of your custom STAC catalog." ,
74+ )
75+ else :
76+ catalog_url = catalog_options [selected_catalog ]
77+ # Show the selected URL as read-only info
78+ st .info (f"Using: { catalog_url } " )
79+
80+
81+ # Function to run the search asynchronously
82+ async def run_search (query , catalog_url = None ):
83+ payload = {"query" : query , "limit" : 10 }
84+ if catalog_url :
85+ payload ["catalog_url" ] = catalog_url .strip ()
86+
87+ response = requests .post (f"{ API_URL } /items/search" , json = payload )
5388 return response .json ()["results" ]
5489
5590
@@ -60,7 +95,7 @@ async def run_search(query):
6095 # Run the async search
6196 loop = asyncio .new_event_loop ()
6297 asyncio .set_event_loop (loop )
63- results = loop .run_until_complete (run_search (query ))
98+ results = loop .run_until_complete (run_search (query , catalog_url ))
6499 items = results ["items" ]
65100 aoi = results ["aoi" ]
66101 explanation = results ["explanation" ]
@@ -212,10 +247,19 @@ async def run_search(query):
212247 """
213248 Search for satellite imagery using natural language.
214249
215- **Examples queries:**
250+ **Available STAC Catalogs:**
251+ - **Planetary Computer**: Microsoft's global dataset catalog
252+ - **VEDA**: NASA's Earth science data catalog
253+ - **E84 Earth Search**: Element 84's STAC catalog for Earth observation data on AWS Open Data
254+ - **DevSeed EOAPI.dev**: DevSeed's example STAC catalog
255+ - **Custom URL**: Enter any STAC-compliant catalog URL
256+
257+ The system will automatically index new catalogs on first use.
258+
259+ **Example queries:**
216260 - imagery of Paris from 2017
217261 - Cloud-free satellite data of Georgia the country from 2022
218- - relatively cloud-free images in 2024 that have RGB visual bands over Longmont, Colorado that can be downloaded via HTTP
262+ - relatively cloud-free images in 2024 over Longmont, Colorado
219263 - images in 2024 over Odisha with cloud cover between 50 to 60%
220264 - NAIP imagery over the state of Washington
221265 - Burn scar imagery of from 2024 over the state of California
0 commit comments