[R-sig-Geo] Script to get polygons area in square meters

latorre.daniel danielvdelatorre at gmail.com
Wed Jul 31 15:39:18 CEST 2013


Hello,

I am really new to GIS and I am posting here to check if what I learned so
far is right. My goal is to measure areas of polygons (representing species
distributions) in square meters. I'm going to use data available as
shapefiles on IUCN Red List website.

To read the polygon into R:

library(sp)
library(rgdal)
library(rgeos)
setwd("~/Folder1/Folder2/Canis_latrans_(Coyote)/")
coyote<-readOGR(dsn=".", layer="species_3745")

The projection is in longlat:

> coyote at proj4string
CRS arguments:
 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 

so area calculation will be in longlat units.

The next step, then, should be transforming the projection. In this case I
chose the equal area Mollweide projection, just because I've seen a paper
using it (but I don't really looked for pros/cons of using any other
projection).

Projection transformation:

coyote_moll<-spTransform(x=coyote,CRSobj=CRS("+proj=moll +ellps=WGS84"))

To get the area:

gArea(coyote_moll)

As I said I am writhing here because I want to be sure if this script is
right, is it? Second, because I couldn't find all these steps together and I
thought it could be useful for someone else in the future.

Also I would like to know if Mollweide is a good projection for that
propose? If not, is there something easy and useful to read about?

My final question is: the 'readOGR' function returns an error if the 'dsn'
argument is a path different from ".". Am I doing something wrong or is it
normal?

Thank you very much in advance! 

Daniel

> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] pt_BR.UTF-8/pt_BR.UTF-8/pt_BR.UTF-8/C/pt_BR.UTF-8/pt_BR.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgeos_0.2-17 rgdal_0.8-10 sp_1.0-11   

loaded via a namespace (and not attached):
[1] grid_3.0.0      lattice_0.20-15 tools_3.0.0 



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Script-to-get-polygons-area-in-square-meters-tp7584312.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list