Geographic Information Systems Asked by Joe Mruzek on February 4, 2021
To calculate the area of polygon in R I have been using the following code (this is the example code from the package’s documentation, mine is modified to contain my data):
p <- shapefile(system.file("external/lux.shp", package="raster"))
p$area <- round(area(p) / 10000000,1)
which returns
p$area
312.3 218.7 259.5 76.2 263.2 188.3 129.0 210.4 185.6 251.3 237.1 233.3
Anyway, these make sense as square km areas of the states of Luxembourg, and when I run this code with my data I get results that makes sense as well.
My question is: what is the CRS?
using crs(p)
gives me CRS arguments: +proj=longlat +datum=WGS84 +no_defs Warning message: In proj4string(x) : CRS object has comment, which is lost in output
From other posts I have learned that the warning code is nothing and that raster::area() returns square meters from lat long coordinates (such is the case here). But I was under the impression that WGS84 was a datum, not a CRS, so what is the CRS? Also why do I divide by 1 million? Is raster::area() converting to square millimeters?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP