export type ImageType = 'png' | 'npy' | 'tif' | 'jpeg' | 'jpg' | 'jp2' | 'webp' | 'pngraw'; export type Position2D = Array; export type Position3D = Array; export type PointInput = {bbox?: (Array | Array | null) | undefined, type: 'Point', coordinates: Position2D | Position3D}; export type MultiPoint = {bbox?: (Array | Array | null) | undefined, type: 'MultiPoint', coordinates: Array}; export type LineString = {bbox?: (Array | Array | null) | undefined, type: 'LineString', coordinates: Array}; export type MultiLineString = {bbox?: (Array | Array | null) | undefined, type: 'MultiLineString', coordinates: Array>}; export type Polygon = {bbox?: (Array | Array | null) | undefined, type: 'Polygon', coordinates: Array>}; export type MultiPolygon = {bbox?: (Array | Array | null) | undefined, type: 'MultiPolygon', coordinates: Array>>}; export type GeometryCollectionInput = {bbox?: (Array | Array | null) | undefined, type: 'GeometryCollection', geometries: Array}; export type BaseModel = Record; export type Feature = {bbox?: (Array | Array | null) | undefined, type: 'Feature', geometry: PointInput | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollectionInput | null, properties: Record | BaseModel | null, id?: (number | string | null) | undefined}; export type CreateApiTilesCogFeatureArgs = {format?: ImageType | undefined, data_path?: (string | null) | undefined, carbon_pool?: (string | null) | undefined, product_type?: (string | null) | undefined, product_variant?: (string | null) | undefined, resolution?: (number | null) | undefined, year?: (number | null) | undefined, analysis_completed_at?: (string | null) | undefined, url?: (string | null) | undefined, bidx?: (Array | null) | undefined, expression?: (string | null) | undefined, nodata?: (number | number | string | null) | undefined, unscale?: (boolean | null) | undefined, resampling?: ('nearest' | 'bilinear' | 'cubic' | 'cubic_spline' | 'lanczos' | 'average' | 'mode' | 'gauss' | 'rms' | null) | undefined, reproject?: ('nearest' | 'bilinear' | 'cubic' | 'cubic_spline' | 'lanczos' | 'average' | 'mode' | 'sum' | 'rms' | null) | undefined, max_size?: (number | null) | undefined, height?: (number | null) | undefined, width?: (number | null) | undefined, coord_crs?: (string | null) | undefined, dst_crs?: (string | null) | undefined, algorithm?: ('hillshade' | 'contours' | 'normalizedIndex' | 'terrarium' | 'terrainrgb') | undefined, algorithm_params?: (string | null) | undefined, rescale?: (Array | null) | undefined, color_formula?: (string | null) | undefined, colormap_name?: ('turbo' | 'rplumbo' | 'turbid' | 'summer_r' | 'pubu' | 'pastel2' | 'greys' | 'oxy' | 'jet_r' | 'ylgnbu_r' | 'gist_yarg_r' | 'coolwarm_r' | 'solar_r' | 'tab20c_r' | 'balance_r' | 'algae' | 'speed' | 'rdylgn' | 'gist_yarg' | 'delta_r' | 'set2' | 'gray_r' | 'spectral' | 'rainbow' | 'jet' | 'greens_r' | 'gnuplot2' | 'flag_r' | 'topo_r' | 'viridis' | 'cubehelix' | 'spring' | 'set1_r' | 'rain_r' | 'pastel2_r' | 'tab10_r' | 'gist_gray_r' | 'hot_r' | 'gist_earth' | 'nipy_spectral_r' | 'purples' | 'twilight_r' | 'amp' | 'gist_gray' | 'copper_r' | 'brbg_r' | 'rdylbu' | 'diff_r' | 'phase_r' | 'ice_r' | 'puor' | 'curl' | 'thermal' | 'inferno_r' | 'gist_stern_r' | 'deep' | 'seismic_r' | 'set2_r' | 'dense_r' | 'seismic' | 'haline' | 'diff' | 'bwr' | 'dense' | 'rdgy' | 'tarn_r' | 'prgn' | 'blues' | 'rdylbu_r' | 'rdpu_r' | 'accent' | 'oranges' | 'matter' | 'hsv' | 'orrd_r' | 'copper' | 'brg_r' | 'pubugn' | 'blues_r' | 'rain' | 'algae_r' | 'rdbu_r' | 'rainbow_r' | 'pubu_r' | 'reds_r' | 'winter' | 'puor_r' | 'spectral_r' | 'flag' | 'inferno' | 'gnbu_r' | 'wistia_r' | 'hot' | 'prism' | 'pubugn_r' | 'balance' | 'afmhot' | 'nipy_spectral' | 'brbg' | 'spring_r' | 'terrain' | 'coolwarm' | 'cividis_r' | 'ylorbr' | 'purd_r' | 'bugn_r' | 'ylgn' | 'bupu_r' | 'amp_r' | 'turbid_r' | 'oranges_r' | 'paired' | 'magma_r' | 'oxy_r' | 'set3_r' | 'purples_r' | 'rdylgn_r' | 'plasma_r' | 'curl_r' | 'ylorrd_r' | 'plasma' | 'wistia' | 'pink' | 'bone_r' | 'set3' | 'ylgnbu' | 'tempo_r' | 'brg' | 'thermal_r' | 'dark2_r' | 'gist_heat' | 'ylorbr_r' | 'twilight' | 'prgn_r' | 'twilight_shifted_r' | 'piyg' | 'gist_earth_r' | 'speed_r' | 'gist_rainbow_r' | 'gist_rainbow' | 'gist_ncar' | 'piyg_r' | 'ylgn_r' | 'set1' | 'ice' | 'cubehelix_r' | 'tab20c' | 'binary' | 'accent_r' | 'delta' | 'bone' | 'gnuplot' | 'reds' | 'tab20' | 'greys_r' | 'gist_heat_r' | 'schwarzwald' | 'rdgy_r' | 'tab10' | 'bupu' | 'cividis' | 'pink_r' | 'tarn' | 'purd' | 'tab20_r' | 'gist_ncar_r' | 'viridis_r' | 'gist_stern' | 'gray' | 'gnbu' | 'tab20b' | 'turbo_r' | 'summer' | 'pastel1_r' | 'binary_r' | 'tempo' | 'cmrmap' | 'ylorrd' | 'matter_r' | 'afmhot_r' | 'ocean' | 'tab20b_r' | 'phase' | 'pastel1' | 'prism_r' | 'haline_r' | 'magma' | 'orrd' | 'cmrmap_r' | 'cfastie' | 'winter_r' | 'hsv_r' | 'terrain_r' | 'solar' | 'gnuplot_r' | 'topo' | 'cool_r' | 'autumn_r' | 'gnuplot2_r' | 'cool' | 'twilight_shifted' | 'ocean_r' | 'rdpu' | 'autumn' | 'greens' | 'bwr_r' | 'deep_r' | 'rdbu' | 'dark2' | 'paired_r' | 'bugn' | '2024-02-23_cumulative_change_light' | '2023-07-18_forest_area_gain_light' | '2023-07-18_forest_area_loss_light' | '2023-07-18_non_forest_light' | '2023-07-18_forest_light' | '2023-07-18_forest_area_degradation_light' | '2024-04-09_stock_light_650' | '2023-06-07_stock_light_100' | '2023-06-07_stock_light_150' | '2023-06-07_stock_light_200' | '2023-06-07_stock_light_250' | '2022-11-18_change_light') | undefined, colormap?: (string | null) | undefined, return_mask?: (boolean | null) | undefined, body: Feature}; export type CreateApiTilesCogFeatureOptions = {baseUrl: string, APIKeyQuery?: string | undefined, fetch?: typeof fetch | undefined}; /** * Feature Image * * POST /tiles/cog/feature */ export const createApiTilesCogFeature = async (args: CreateApiTilesCogFeatureArgs, options: CreateApiTilesCogFeatureOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIKeyQuery} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "image/png") if (args.format != null) query.append("format", String(args.format)) if (args.data_path != null) query.append("data_path", String(args.data_path)) if (args.carbon_pool != null) query.append("carbon_pool", String(args.carbon_pool)) if (args.product_type != null) query.append("product_type", String(args.product_type)) if (args.product_variant != null) query.append("product_variant", String(args.product_variant)) if (args.resolution != null) query.append("resolution", String(args.resolution)) if (args.year != null) query.append("year", String(args.year)) if (args.analysis_completed_at != null) query.append("analysis_completed_at", String(args.analysis_completed_at)) if (args.url != null) query.append("url", String(args.url)) for (const item of args.bidx ?? []) query.append("bidx", String(item)) if (args.expression != null) query.append("expression", String(args.expression)) if (args.nodata != null) query.append("nodata", String(args.nodata)) if (args.unscale != null) query.append("unscale", String(args.unscale)) if (args.resampling != null) query.append("resampling", String(args.resampling)) if (args.reproject != null) query.append("reproject", String(args.reproject)) if (args.max_size != null) query.append("max_size", String(args.max_size)) if (args.height != null) query.append("height", String(args.height)) if (args.width != null) query.append("width", String(args.width)) if (args.coord_crs != null) query.append("coord_crs", String(args.coord_crs)) if (args.dst_crs != null) query.append("dst_crs", String(args.dst_crs)) if (args.algorithm != null) query.append("algorithm", String(args.algorithm)) if (args.algorithm_params != null) query.append("algorithm_params", String(args.algorithm_params)) for (const item of args.rescale ?? []) query.append("rescale", String(item)) if (args.color_formula != null) query.append("color_formula", String(args.color_formula)) if (args.colormap_name != null) query.append("colormap_name", String(args.colormap_name)) if (args.colormap != null) query.append("colormap", String(args.colormap)) if (args.return_mask != null) query.append("return_mask", String(args.return_mask)) if (APIKeyQuery !== undefined) query.set("access_token", APIKeyQuery) const url = `${baseUrl.replace(/\/+$/, '')}/tiles/cog/feature${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };