Dear list,

I would like to calculate the area of a polygon. I have found areapl() in 
splancs but am having trouble using it.

x<-1
poly <- readShapePoly("a1_l4_aerial_ws.shp", IDvar="cat", 
proj4string=CRS("+proj=tmerc +south +ellips=WGS84 +datum=WGS84 +lon_o=31 +k_0=1 
+units=m +no_defs"))
poly_add <- poly[poly$cat[x], ]
areapl(poly_add)
Error in `[.data.frame`(x...@data, i, j, ..., drop = FALSE) : 
  undefined columns selected

I have tried various combinations of commands with all returning either an 
error or 0. I know the area of the polygon is 4.760465 square meters (area 
slot) but cant seem to replicate this using areapl(). Is it possible to access 
the area slot directly instead of computing the area with areapl()? 

Many thanks,
Wesley 


Wesley Roberts MSc.
Researcher: Earth Observation (Ecosystems)
Natural Resources and the Environment
CSIR
Tel: +27 (21) 888-2490
Fax: +27 (21) 888-2693

"To know the road ahead, ask those coming back."
- Chinese proverb




-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to