# EGMStream Webapp: EGMS Data Downstream Solution
## 2 Materials and Methods
### Mandatory and Optional Input Data  
The application accepts two distinct types of input files to initiate the data processing workflow: (i) a mandatory input file containing links to EGMS data and (ii) an optional input file specifying the area of interest (AoI).  
The mandatory file is a textual file (_txt_), downloadable from the EGMS Explorer. The file contains one or more links with information on the tiles (for L3 products) or burst (for L2 data) over the area selected by the user.  
The EGMS Explorer [(46)] can be easily accessed directly through the '_EGMS Explorer_' button on the EGMSstream webapp interface. After the registration and authentication on the EU portal, users can draw an area and choose between all the available datasets on the Explorer. To avoid downloading too much data in a single session, a limitation on area selection is imposed by the system: the spatial area must not exceed a width of 3 degrees. Once the area is selected, users have to specify the desired product type (L2a, L2b, or L3) and time of interest (2018-2022 or 2019-2023), and then clicking the '_Download Links_' button,  
Figure 1: EGMSream webapp workflow. The diagram illustrates the sequential steps of the EGMStream webapp, using red labels for negative responses (No) and green labels for positive responses (Yes), representing the possible choices made by users. Users are prompted to upload the EGMS data in _txt_ format and optionally the area of interest (AoI) file in _kml_, _knz_, or _shp_ format. The webapp then downloads the EGMS data, extracts the necessary files, and converts the data. At the end of the conversion, users receive an email for downloading the converted data.  
the system generates the _.txt_ file containing hyperlinks to the selected products for bulk download. Each link comprises the following:  
* the link to the EEA server where the link is stored;
* the product level, track, and internal EEA number referring to the selected tile or burst;
* a randomly generated (non-replicable) ID token, which allows the validity of each download link only for an hour.  
Even though the token is valid for one hour from the start of the download of the text file, if the download process is in progress, the token remains valid until the end of the download [53]. If the token time validity has expired, the application will be unable to start the download and data conversion cannot proceed. In this case, the user will need to download a new _.txt_ file with updated links. The EGMStream webapp is designed to process the file downloaded from the EGMS Explorer directly. An upload control ensures that the contained links correspond to the EGMS data, and in case the uploaded _.txt_ file contains invalid text or links, a red warning will appear, prompting the user to upload the correct file.  
The webapp also allows users to crop data to a specific area by uploading an optional geospatial file. This possibility significantly enhances the flexibility and accuracy of the data clipping process. Users can define the AoI by uploading pre-existing files in widely used geospatial formats supported by Google Earth, i.e., Keyhole Markup Language (_.kml_), Keyhole Markup Language Zipped (_kmlz_), and GIS (Geographic Information System), i.e., ESRI shapefile (_.slhp_). The shapefile (_.slhp_) format must be uploaded in a _.zip_ folder containing the _.slhp_ file along with the associated files (_.dbf_, _slx_, and _.prj_).