Having problems calculating polygon area from coordinates


I'm trying to calculate area of polygons in km^2, but I dont know how to interpret the values or how to translate the values to km^2. I've been using the polyarea function: polyarea function - RDocumentation

As you can see in my data below, the polygon area has been calculated to 163. What unit is it? It certainly isn't km^2.

Any ideas?

Here's a small subset of my data:

stringsAsFactors = FALSE,
Currentid = c("Acraea issoria",
"Acraea issoria","Acraea issoria","Acraea issoria","Acraea issoria",
"Acraea issoria","Acraea issoria","Acraea issoria",
"Acraea issoria","Acraea issoria","Acraea issoria",
"Acraea issoria"),
Lat = c(30.0033,30.0033,30.0033,
Lon = c(119.8,119.8,119.8,77.8575,
polyarea = c(163.1910525,163.1910525,

Thank you!!!

The polyarea() function does not calculate area on a sphere or ellipse. It is intended for coordinates in the plane. Try using the sf library and the st_area() function. But, you will need to work out how to convert your coordinates (which I presume are in latitude and longitude) into an sf object.

I see, thank you for your comment.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.