Dear William, thanls a lot for your attention.
This is my C# code:
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), _config.ProcessServiceURL))
{
request.Headers.TryAddWithoutValidation("Authorization", "Bearer " + token);
var multipartContent = new MultipartFormDataContent();
var queryStr = JsonConvert.SerializeObject(req);
multipartContent.Add(new StringContent(queryStr), "request");
multipartContent.Add(new StringContent("//VERSION=3\n\nfunction setup() {\n return {\n input: [\"B04\", \"B08\", \"dataMask\"],\n output: {bands: 4}\n };\n}\n\nfunction evaluatePixel(sample) {\n let ndvi = index(sample.B08, sample.B04);\n let imgVals = null;\n \n if (ndvi < -0.5) imgVals = [0.047, 0.047, 0.047];\n else if (ndvi < .1) imgVals = [0.92, 0.92, 0.92];\n else if (ndvi < 0.2) imgVals = [1, 0, 0];\n else if (ndvi < 0.3) imgVals = [1, 0.18, 0];\n else if (ndvi < 0.4) imgVals = [1, 0.55, 0];\n else if (ndvi < 0.5) imgVals = [1, 0.65, 0];\n else if (ndvi < 0.6) imgVals = [1,1,0];\n else imgVals = [0, 0.27, 0]; \n \n imgVals.push(sample.dataMask)\n\n return imgVals\n}"), "evalscript");
request.Content = multipartContent;
var response = await httpClient.SendAsync(request);
string contentStr = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
var responseBody = await response.Content.ReadAsByteArrayAsync();
bytes = responseBody;
}
else
{
message = contentStr;
}
}
}
In the particular case of the GeoJson area returning a void NDVI,
queryStr={“input”:{“bounds”:{“properties”:{“crs”:“http://www.opengis.net/def/crs/OGC/1.3/CRS84"},“bbox”:null,“geometry”:{“type”:“Polygon”,“coordinates”:[[[17.943034,40.505903],[17.943882,40.506001],[17.94371,40.505218],[17.943989,40.504043],[17.945244,40.504231],[17.945266,40.503945],[17.945577,40.504035],[17.945486,40.503721],[17.945582,40.503684],[17.945609,40.503407],[17.94194,40.502681],[17.943034,40.505903]]]}},“data”:[{“type”:“sentinel-2-l2a”,“dataFilter”:{“timeRange”:{“from”:“2024-05-10T00:00:00Z”,“to”:“2024-05-13T00:00:00Z”}},“processing”:null}]},“output”:{“width”:640,“height”:640,“resx”:null,“resy”:null,“responses”:[{“identifier”:“default”,“format”:{“type”:"image/png”}}]}}
As I stated initially, this same code returns significative NDVI image in the 95% of the cases, only on some areas, indipendently from the period asked, always “transparent” values are returned-