Turning degrees into square kilometres (km2)?

After running raster layer unique value report I have got pixel number and area in degree.

How can I turn it in square kilometres (km2)?

• You need to reproject your raster to a coordinate reference system (CRS) defined in meters (or feet, or hands, or whatever meaningful length unit), and then compute your statistics. – Jon Feb 11 at 23:10
• It would be much better to convert your raster into polygons and project, unique value rasters don't resample well when projecting, the cell becomes a trapezoid which is then squashed into the nearest match rectangle (Nearest Neighbor). Converting your raster into polygons, dissolving the boundaries between same cells, allows your cells to retain their trapezoidal shape (mostly) preserving the coverage in degrees but in a projected coordinate system which can have areas calculated and summarized. – Michael Stimson Feb 12 at 5:13
• Please update your question to add the software that you are using. – ahmadhanb Feb 12 at 6:33
• Using QGIS 3.4.4. I'm totally beginner. – Ferenc Mics Feb 12 at 7:55

You can not.

Think in the Earth as a sphere. One degree of latitude represents always the same length, and only depends of the radius of the sphere. But one degree of longitude represents different lengths depending of (the radius of the sphere and) the latitude in which that degree of longitude difference was measured. The ratio is trigonometric in the sphere, so that at the equator, a difference of one degree in longitude only depends on the radius of the sphere, and at the poles a difference of one degree of longitude equals zero meters length.

Even being able to convert differences of longitudes and latitudes into distances, knowing in which part of the Earth those differences took place, a degree^2 can't be converted to km^2. Because 1 degree^2 can be 1 degree of longitude difference by 1 degree of latitude difference, or 2 degrees of longitude difference by 0.5 degrees of latitude difference, or any of the other endless possibilities, returning all of them a different result.

Therefore, what corresponds is to project the raster to an appropriate coordinate system that allows it to ensure that each pixel of the image encompasses the same terrestrial surface, and then perform spatial analyzes over those pixels.

Jon's suggestion is correct. Generally, the steps are as follow:-

1) Choose a suitable map projection for the area of interest ("AOI"), including the values for the (map) projection parameters. This part of the answer can be more specific if you hint the bounding latitudes and longitudes for the AOI.

2) Work with the projected result whose UOM is now in metric meter.

3) Avoid whole-world projections esp the Web Mercator (EPSG 3857), unless:-

a) Your AOI is relatively small, or
b) You are within 3~5% lat of the Equator, or
c) You are not concern about grid directions, or
d) You can accept relatively large margin of error.