[R-sig-Geo] Problem finding the centroid of a polygon with get.Pcent

Mauricio Zambrano hzambran.newsgroups at gmail.com
Fri May 23 17:54:29 CEST 2008


Dear List,

For finding the centroid of a catchment, I tried with the function:

 get.Pcent(gallego_catchment)

but I got the following  error:

Error en get.Pcent(gallego_catchment) : not a Map object

However, I checked the class:

> class(gallego_catchment)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"

and I read the catchment boundary with:

p4s <- CRS("+proj=utm +zone=30 +ellps=intl +units=m +no_defs")
# reading the boundary of the gallego catchment
library(maptools)
gallego_catchment <- readShapePoly("only_gallego_catchment.shp",
proj4string=p4s)

Could somebody tell me if I'm doing something wrong?

Thanks in advance

Mauricio

-- 
hzambran

Linux user #454569 -- Ubuntu user #17469




More information about the R-sig-Geo mailing list