21using namespace Qt::StringLiterals;
59 return format ==
"COG"_L1 || format ==
"COPC"_L1 || format ==
"EPT"_L1 || format ==
"Zarr"_L1 || format ==
"Parquet"_L1 || format ==
"TileDB"_L1;
64 if ( mMediaType ==
"image/tiff; application=geotiff; profile=cloud-optimized"_L1 || mMediaType ==
"image/vnd.stac.geotiff; cloud-optimized=true"_L1 )
66 else if ( mMediaType ==
"application/vnd.laszip+copc"_L1 )
68 else if ( mHref.endsWith(
"/ept.json"_L1 ) )
70 else if ( mMediaType ==
"application/vnd+zarr"_L1 )
72 else if ( mMediaType ==
"application/vnd.apache.parquet"_L1 )
74 else if ( mMediaType.contains(
"tiledb"_L1, Qt::CaseInsensitive ) )
88 uri.layerType = u
"vector"_s;
89 uri.providerKey = u
"ogr"_s;
93 uri.layerType = u
"raster"_s;
94 uri.providerKey = u
"gdal"_s;
97 if (
href().startsWith(
"http"_L1, Qt::CaseInsensitive ) ||
href().startsWith(
"ftp"_L1, Qt::CaseInsensitive ) )
99 uri.uri = u
"/vsicurl/%1"_s.arg(
href() );
100 if ( !authcfg.isEmpty() )
101 uri.uri.append( u
" authcfg='%1'"_s.arg( authcfg ) );
103 else if (
href().startsWith(
"s3://"_L1, Qt::CaseInsensitive ) )
105 uri.uri = u
"/vsis3/%1"_s.arg(
href().mid( 5 ) );
107 else if (
href().startsWith(
"azure://"_L1, Qt::CaseInsensitive ) )
109 uri.uri = u
"/vsiaz/%1"_s.arg(
href().mid( 8 ) );
111 else if (
href().startsWith(
"az://"_L1, Qt::CaseInsensitive ) )
113 uri.uri = u
"/vsiaz/%1"_s.arg(
href().mid( 5 ) );
115 else if (
href().startsWith(
"gcp://"_L1, Qt::CaseInsensitive ) )
117 uri.uri = u
"/vsigs/%1"_s.arg(
href().mid( 6 ) );
126 uri.uri = u
"ZARR:\"%1\""_s.arg(
uri.uri );
131 uri.layerType = u
"pointcloud"_s;
132 uri.providerKey = u
"copc"_s;
134 if ( !authcfg.isEmpty() )
135 uri.uri.append( u
" authcfg='%1'"_s.arg( authcfg ) );
139 uri.layerType = u
"pointcloud"_s;
140 uri.providerKey = u
"ept"_s;
142 if ( !authcfg.isEmpty() )
143 uri.uri.append( u
" authcfg='%1'"_s.arg( authcfg ) );
157 QString html = u
"<h1>%1</h1>\n<hr>\n"_s.arg(
"Asset"_L1 );
158 html +=
"<table class=\"list-view\">\n"_L1;
159 html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"_s.arg( u
"id"_s, assetId );
160 html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"_s.arg( u
"title"_s,
title() );
161 html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"_s.arg( u
"description"_s,
description() );
162 html += u
"<tr><td class=\"highlight\">%1</td><td><a href=\"%2\">%2</a></td></tr>\n"_s.arg( u
"url"_s,
href() );
163 html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"_s.arg( u
"type"_s,
mediaType() );
164 html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"_s.arg( u
"roles"_s,
roles().join(
',' ) );
165 html +=
"</table><br/>\n"_L1;
bool isCloudOptimized() const
Returns whether the asset is in a cloud optimized format like COG or COPC.
QString formatName() const
Returns the format name for cloud optimized formats.
QStringList roles() const
Returns the roles assigned to the asset.
QString toHtml(const QString &assetId) const
Returns an HTML representation of the STAC Asset including its ID within its container.
bool isDownloadable() const
Returns whether the asset can be downloaded.
QString mediaType() const
Returns the media type of the asset.
QString href() const
Returns the URI to the asset object.
QgsMimeDataUtils::Uri uri(const QString &authcfg=QString()) const
Returns a uri for the asset if it is a cloud optimized file like COG or COPC.
QgsStacAsset(const QString &href, const QString &title, const QString &description, const QString &mediaType, const QStringList &roles)
Constructor.
QString title() const
Returns the displayed title for clients and users.
QString description() const
Returns a description of the Asset providing additional details, such as how it was processed or crea...