Skip to main content

I download the images with the following script to get DN values.


//VERSION=3
function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B08", "B05", "B06", "B07", "B8A", "B11", "B12"],
units: "DN"
}],
output: {
bands: 4,
sampleType: "INT16"
}
};
}
function evaluatePixel(sample) {
return [sample.B01,
sample.B02,
sample.B03,
sample.B04,
sample.B05,
sample.B06,
sample.B07,
sample.B08,
sample.B8A,
sample.B1972,
sample.B12];
}






resulting true colour images in QGIS:


I am not sure why, although the CRS is the same as the downloaded response.

Can you share the full request?


If you are using WGS84 and specifying the resolution in degrees, it is normal in northern and southern latitudes that the pixels are rectangular since the projection stretches the longitude (East-West direction) more and more the further you go away from the equator.


If your area of interest fits into one UTM Zone, try specifying this zone as the CRS. This should give you square pixels. Otherwise if it doesn’t fit into an UTM Zone, you can also use EPSG:3857


Thanks for the answer @jonas.viehweger . I used epsg: 4326 and specified resolution in the request builder as 10*10m. My complete request as follows.



Based on your suggestion. I found the UTM zone of my area and set the CRS to 32632, but I still get rectangular pixel. This will mean my resolution is much lesser then 10m ( Pixel size in QGIS shows: 10.0099341393027057,-9.999654379028104501)


Did you remember to set the map CRS in QGIS to UTM as well? Your pixels are very close to 10 by 10m, with that you can trust the pixel size in QGIS. So the data should be square and if it doesn’t display it like that it is only because of the projection in QGIS.


Yes, the CRS is set to UTM 32N as well. It is weird. Another stupid question, I am aware the project might change the pixel size a bit, but why is it -9.99 and not 10 m in the QGIS pixel value


Can you copy and paste the entire curl request you are using which is displayed under Request Preview so I can take a look at what is happening?


The curl request is too big to be sent here (Forum replies have a limit) but here is the polygon and function:


admin8_garbsen.kml (6.7 KB)


Function:


//VERSION=3
function setup() {
return {
input: [{
bands: ["B01", "B02", "B03", "B04", "B08", "B05", "B06", "B07", "B8A", "B11", "B12"],
units: "DN"
}],
output: {
bands: 4,
sampleType: "INT16"
}
};
}
function evaluatePixel(sample) {
return [sample.B01,
sample.B02,
sample.B03,
sample.B04,
sample.B05,
sample.B06,
sample.B07,
sample.B08,
sample.B8A,
sample.B11,
sample.B12];
}




In the bottom right in QGIS, what does it say? It should be EPSG:32633


I tried your request and the pixels are square:



Thanks @jonas.viehweger .That is great, i was looking at the properties of the .tiff file in QGIS and it showed 32632, I did not check the bottom epsg parameter. Thanks!


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


Reply