Skip to content
Prev 3649 / 29559 Next

Problem finding the centroid of a polygon with get.Pcent

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:
[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