wallaceEcoMod / changeRangeR

R package for calculating metrics of species distributions
GNU General Public License v3.0
4 stars 2 forks source link

Wrong area calculations using WGS84 (AOOarea function) #2

Open gepinillab opened 1 year ago

gepinillab commented 1 year ago

Hi changeRangeR team,

I want to draw attention to a common error in geographic data analysis: using rasters in geographic coordinate systems (such as WGS84) for area calculations in meters. While these projections are commonly used to display geographic data, they are inappropriate for accurate area measurements in meters. The area of a pixel can vary significantly depending on its location, particularly at high latitudes. As a result, using unprojected rasters in WGS84 for area calculations can produce inaccurate and misleading results.

To illustrate this point, I have created a plot showing how the area of pixels changes with latitude. As you can see, there is significant distortion in the areas of pixels at higher latitudes. image

As you can see in the plot, it is incorrect to assume that a pixel resolution of 30 arcseconds is approximately 1 km². At the equator, a 30-arcsecond pixel has an area of approximately 0.85 km². However, at higher latitudes, such as New York City at 40 degrees, the area of a 30-arcsecond pixel is approximately 0.65 km². Any area calculation using AOOarea() with an unprojected raster in WGS84 will be at least 15% off.

Therefore, I suggest we encourage using appropriate projections for accurate area measurements in meters. While UTM and Lambert conformal conic projections are commonly used to represent shapes accurately, equal-area projections are designed to preserve the area of features. Also, vignettes and documentation should be updated.

Feel free to let me know if you have any questions.

Best, Gonzalo

andrepazv commented 1 year ago

Hi Gonzalo,

As we had discussed before in the meetings this was included in the vignette like this: "It is suggested that users reproject ranges to an equal area projection for more accurate area-based calculations". Do you mean you want to include this as a warning in the function execution itself? If so I think it is a great idea, are you added as a contributor? Or maybe Cory needs to add you so you can make the change?

gepinillab commented 1 year ago

Hi Andrea,

The text in the vignette is a great improvement, but still, the documentation of the function and the vignette example suggest unprojected as a good decision. Here is the test in the function: "Must be either unprojected in the WGS84 datum or projected in an equal area projection (see IUCN guidelines) measured in meters. Unprojected rasters will result in an estimate while those projected in an equal area projection will be more accurate."

Although the text mentions that equal area projection is more accurate, I still think that is insufficient because it does not dimension how WGS84 always overestimates areas (at least 15%), which I think users should be aware of, especially for their application in conservation decision-making.

I will be glad to make changes. Although, I will have time to work on it in a couple of months.