import moment from 'moment' ; import { PaginatedTiles , Link , LinkType } from './const' ; import { DATASET_S3OLCI } from './dataset' ; import { AbstractSentinelHubV3Layer } from './AbstractSentinelHubV3Layer' ; export class S3OLCILayer extends AbstractSentinelHubV3Layer { public readonly dataset = DATASET_S3OLCI ; protected convertResponseFromSearchIndex ( response ) { return { tiles : response . data . tiles . map ( tile => ( { geometry : tile . dataGeometry , sensingTime : moment . utc ( tile . sensingTime ) . toDate ( ) , meta : { } , links : this . getTileLinks ( tile ) , } ) ) , hasMore : response . data . hasMore , } ; } protected getTileLinks ( tile ) { return [ { target : tile . originalId . replace ( 'EODATA' , '/eodata' ) , type : LinkType . CREODIAS , } , { target : `https://finder.creodias.eu/files${ tile . originalId . replace ( 'EODATA' , '' ) }/${ tile . productName . replace ( '.SEN3' , '' ) }-ql.jpg` , type : LinkType . PREVIEW , } , ] ; } protected getTileLinksFromCatalog ( feature ) { const { assets } = feature ; let result = super . getTileLinksFromCatalog ( feature ) ; if ( assets . data && assets . data . href ) { result . push ( { target : assets . data . href . replace ( 's3://DIAS' , '/dias' ) , type : LinkType . CREODIAS } ) ; } return result ; } }