My problem is that every coordinates I put the result is black in the request builder or Python using API of Planet but If I change it to Sentinel it worked.
Also i try to use EO Browser and do the effect of true color o false color nothing is working. (I tried to change and use customer and put bunds by myself and it didn’t work).
If I use the same coordinates with sutinelhub it worked but with Planet no. The result all time in black.
If you didn’t understand me we could do meeting and explain to you.
Thanks
This is script may only work with sentinelhub.version >= ‘3.4.0’
from sentinelhub import SentinelHubRequest, DataCollection, MimeType, CRS, BBox, SHConfig, Geometry
import os
from PIL import Image
def descargarImg(request):
for folder, _, filenames in os.walk(request.data_folder):
for filename in filenames:
print(os.path.join(folder, filename))
request.save_data();
Credentials
config = SHConfig()
config.sh_client_id = ‘-----’
config.sh_client_secret = ‘-----’
def convertirImagen(archivoImagen,archivoDestino):
im=Image.open(archivoImagen)
im.save(archivoDestino)
“”"
parametros poligono tienen qu
“”"
def buscarImg(cord1, cord2, cord3, cord4, fechaIni, fechaFin, nombreCarpeta, tipo):
if tipo==“trueColor”:
evalscript = “”"
//VERSION=3
function setup() {
return {
input: [{“bands”: [“Blue”, “Green”, “Red”]}],
output: { bands: 3}
}
}
function evaluatePixel(sample) {
return [2.5 * sample.Red / 10000,
2.5 * sample.Green / 10000,
2.5 * sample.Blue / 10000]
}
“”"
elif tipo==“GNDVI”:
evalscript = “”"
//VERSION=3
function setup() {
return {
input: [“Green”, “NIR”, “dataMask”],
output: { bands: 4}
}
}
function evaluatePixel(sample) {
var GNDVI = index(sample.NIR , sample.Green)
return valueInterpolate(GNDVI,
[0.0, 0.3, 1.0],
[
[1, 0, 0, sample.dataMask],
[1, 1, 0, sample.dataMask],
[0.1, 0.3, 0, sample.dataMask],
])
}
“”"
elif tipo==“NVDI”:
evalscript = “”"
//VERSION=3
function setup() {
return {
input: [“Red”, “NIR”, “dataMask”],
output: { bands: 4}
}
}
function evaluatePixel(sample) {
var NDVI = index(sample.NIR , sample.Red)
return valueInterpolate(NDVI,
[0.0, 0.3, 1.0],
[
[1, 0, 0, sample.dataMask],
[1, 1, 0, sample.dataMask],
[0.1, 0.3, 0, sample.dataMask],
])
}
“”"
elif tipo==“falseColor”:
evalscript = “”"
//VERSION=3
function setup() {
return {
input: [{
bands: [“NIR”, “Red”, “Green”]
}],
output: {
bands: 3,
sampleType: “FLOAT32”
}
}
}
function evaluatePixel(sample) {
return [sample.NIR / 10000,
sample.Red / 10000,
sample.Green / 10000]
}
“”"
bbox = BBox(bbox=[-5.7585989, 37.3886755, -5.7565442, 37.3910112], crs=CRS.WGS84)
geometry = Geometry(geometry={"coordinates":[[[-5.7580946,37.3905082],[-5.7579981,37.3903292],[-5.7585989,37.3902355],[-5.7585453,37.3893489],[-5.7583629,37.3886755],[-5.7573811,37.3887778],[-5.7565442,37.3910112],[-5.7580946,37.3905082]]],"type":"Polygon"}, crs=CRS.WGS84)
request = SentinelHubRequest(
data_folder=nombreCarpeta,
evalscript=evalscript,
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.define_byoc('---------'),
time_interval=('2022-07-10', '2022-08-10'),
),
],
responses=[
SentinelHubRequest.output_response('default', MimeType.JPG),
],
bbox=bbox,
geometry=geometry,
size=[512, 512],
config=config
)
response = request.get_data()
return request
request=buscarImg(562218, 5174019, 564201, 5172501, ‘2021-08-20’, ‘2021-08-20’,‘trueColor’, ‘trueColor’)
descargarImg(request)
print(request)