kapadia / usgs

Client library for interfacing with USGS datasets
http://kapadia.github.io/usgs/
ISC License
109 stars 38 forks source link

'Where' parameter documentation #24

Closed drewbo closed 9 years ago

drewbo commented 9 years ago

Not sure how to search using additional filtering parameters (both syntax and which parameters can be queried on):

from usgs import api

where = {'WRS Path': '043'}
api.search('LANDSAT_8', 'EE',  where=where, start_date='2015-04-01', end_date='2015-05-01', max_results=10, extended=True)

usgs.USGSError: Could not complete search request: Failed to append additional criteria to query.
kapadia commented 9 years ago

@drewbo - I added info to the api.search docstring, and included an example in the documentation.

Additional info is at https://github.com/mapbox/usgs/issues/16#issuecomment-89053631

The where parameter is non-intuitive as it depends on knowing some wonky codes associated with each queryable field. The CLI abstracts the need to know these codes, though it does assume you know which fields are queryable. This comes at the cost of an additional request to the dataset-fields endpoint, something that I'd like to leave out when using api.search.

drewbo commented 9 years ago

Awesome. Thanks a bunch; confusing codes but the additions and examples are really helpful.

kapadia commented 9 years ago

Cool. Let me know if you can think of a way to make it more intuitive. One thought, was to store a mapping of codes to fields within the package, but I worry that field codes are not static.