{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Search" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Searching for products is one of the most important features of `eodag`. This page describes the different methods available to search for products and the parameters that these methods accept." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "`eodag` is set here to search for *Sentinel 2 Level-1C* products with *PEPS*." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-02-19 12:00:29,455 eodag.config [INFO ] Loading user configuration from: /home/sylvain/.config/eodag/eodag.yml\n", "2024-02-19 12:00:29,545 eodag.core [INFO ] Locations configuration loaded from /home/sylvain/.config/eodag/locations.yml\n" ] } ], "source": [ "from eodag import EODataAccessGateway\n", "from eodag import setup_logging\n", "setup_logging(2)\n", "\n", "dag = EODataAccessGateway()\n", "dag.set_preferred_provider(\"peps\")" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "A default set of search criteria is defined, the area of interest is in the South-West of France." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "default_search_criteria = {\n", " \"productType\": \"S2_MSI_L1C\",\n", " \"start\": \"2021-03-01\",\n", " \"end\": \"2021-03-31\",\n", " \"geom\": {\"lonmin\": 1, \"latmin\": 43, \"lonmax\": 2, \"latmax\": 44}\n", "}" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Pagination" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "A [Google search](https://www.google.com/search?q=eodag) displays the first result page, which has 10 items (i.e. URLs). An action is required to get the next results, i.e. the second page, which would also contain 10 items. This process has the advantage of sending less data through the web, as a consequence the results are displayed faster. And after all, in most cases the URLs obtained from the first page are enough.\n", "\n", "Pagination is what is described above. Most EO product providers operate this way, they return by default the first page result with a given number of items (i.e. products). Since pagination is ubiquitous among providers, it is built deep into `eodag` too and its search capabilities." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Search methods" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "The three search methods introduced below accept pretty much the same parameters, which are described further down the page." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### [search()](../../api_reference/core.rst#eodag.api.core.EODataAccessGateway.search)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "[search()](../../api_reference/core.rst#eodag.api.core.EODataAccessGateway.search) was the first search method implemented in `eodag`. It returns a tuple with:\n", "\n", "* a [SearchResult](../../api_reference/searchresult.rst#eodag.api.search_result.SearchResult) that stores the products obtained from a given **page** and a given maximum **number of items per page**\n", "* an integer that is the **estimated** total number of products matching the search criteria\n", "\n", "By default, [search()](../../api_reference/core.rst#eodag.api.core.EODataAccessGateway.search) **returns the products from the first page with a maximum of 20 products**. This means\n", "that it is often expected to obtain a [SearchResult](../../api_reference/searchresult.rst#eodag.api.search_result.SearchResult) that contains 20 products and a much larger estimated\n", "total number of products available.\n", "\n", "