Could not get coordinates information in TIFF when fetching data through Python API

Hello Fellows,

Unfortunately I spend hours but unable to get the bbox (rasterio python) from tif file fetched through senitelhub python process api.
Is there any way i can get coordinate info with tif when response is np array ?
Findings:
Reading several articles lead to me that coordinates information not present when response is np array, as we convert np array to tif file.
when i download tif from senitelhub request builder, rasterio script fetch bbox without any issues.
I also used ‘get_data(save_data=True)’ it also works but did not provide multiple file download through SentinelHubDownloadClient

Code:
evalscript_true_color = “”"
//VERSION=3
function setup() {
return {
input: [{
bands:[“B04”, “B08”, “dataMask”],
}],
output: [{
id: “default”,
bands: 1,
sampleType: SampleType.FLOAT32
},
{
id: “ndvi_image”,
bands: 4
}]

}
}
function evaluatePixel(sample) {
let ndvi = (sample.B08 - sample.B04) / (sample.B08 + sample.B04)
if (sample.dataMask == 0) image = [0, 0, 0, 0]
else if (ndvi>=0.543 && ndvi<=0.68 ) image = [0,0.75,0, 1]
else if (ndvi>=0.405 && ndvi<=0.542) image = [0,1,0, 1]
else if (ndvi>=0.268 && ndvi<=0.404) image = [1,1,0, 1]
else if (ndvi>=0.13 && ndvi<=0.267) image = [1,0.7,0, 1]
else if (ndvi>-0.00841 && ndvi<=0.129) image = [1,0,0, 1]
else image = [0,0.27,0, 1]
return {
  default: [ ndvi ],
  ndvi_image: image
}

}
“”"
def get_true_color_request(time_interval):
return SentinelHubRequest(
evalscript=evalscript_true_color,
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L1C,
time_interval=time_interval,
mosaicking_order=MosaickingOrder.LEAST_CC,
)
],
responses=[SentinelHubRequest.output_response(“default”, MimeType.TIFF),
SentinelHubRequest.output_response(‘ndvi_image’, MimeType.PNG),],
geometry=geometry,
size = geometry_size,
config=config,
)

# create a list of requests
list_of_requests = [get_true_color_request(slot) for slot in slots]
list_of_requests = [request.download_list[0] for request in list_of_requests]

# download data with multiple threads
data = SentinelHubDownloadClient(config=config).download(list_of_requests, max_threads=5)

Hi Asif,

You can use gdalinfo to return information such as the coordinate info of your GeoTIFF.

Thanks William !
Actually i am using geotiff.js on web page, as geotiff does not have coordinate information so geotiff.js getboundingbox failed, also no geokeys available.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.