I have a long list of points covering all of North America for which I would like to calculate the centroid (by grouping points based on the "Name" column).

My approach is to take the WGS84 co-ordinates and project them into North America Equidistant Conic; and then use gCentroid from rgeos to calculate the centres, like so:

#Using: http://www.spatialreference.org/ref/esri/102010/ we get the Proj4js format
no_am_eq_co <- "+proj=eqdc +lat_0=0 +lon_0=0 +lat_1=20 +lat_2=60 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
wgs84 <- "+proj=longlat +datum=WGS84"

# FROM: Coordinates are geographic latitude/longitudes
coordinates(in_data) <- c("lon", "lat")
proj4string(in_data) <- CRS(wgs84)

# TO: Project into North America Equidistant Conic
df <- spTransform(in_data, CRS(no_am_eq_co))

# Get centroids
ctrs <- lapply(unique(df$Name), function(x) gCentroid(df[df$Name==x,]))
ctrsout <- setNames( ctrs , unique(df$Name ) )

# Create data frame 
df <- do.call(rbind, lapply(ctrsout, data.frame, stringsAsFactors=FALSE))
coordinates(df) <- c("x", "y")
proj4string(df) <- CRS(no_am_eq_co) 
df <- as.data.frame(spTransform(df, CRS(wgs84)))
names(df) <- c("longitude", "latitude")

However, I wonder if using for example the lambert projection would be better (i.e. more accurate centroids)?

It is my understanding that the equidistant conic minimises distance distortions(which is what I think I need to get centroids), compared to the lambert conformal conic which minimises shape distortions.

  • If each group of points is relatively localized, the choice of projection will matter little. But just how accurate do you need these calculations to be? That will indicate how hard you should work to compute the centroids.
    – whuber
    Feb 3 '16 at 17:26
  • 1
    @whuber Well, purely out of interest actually I would like to get it down to the metre.
    – mptevsion
    Feb 3 '16 at 18:59
  • That's the right kind of quantitative criterion to provide. But one meter over what size region? For instance, if each group of points is located within some 100-meter circle, there will be no problem; but if you have some groups of points scattered across the continent, then you will need to use 3D Cartesian coordinates (and incorporate elevations in your calculations). For almost any conceivable application that would be overkill, because centroids are typically proxies for other forms of centers which would be difficult or impossible to compute in the first place.
    – whuber
    Feb 3 '16 at 19:04
  • I see, thank you! For sake of example if we assume that the maximum scatter of points is bounded by North America. And that the alternative approach would be to project each point to the UTM zone it is located in? Finally, whether for centroids it is more better to chose a projection that minimises shape, area or distance
    – mptevsion
    Feb 3 '16 at 19:06
  • 1
    You could do that, but it would be easier just to convert to Cartesian (3D) coordinates, especially because to get one-meter accuracy you will need to account for the elevations. It also depends on what you really mean by "centroid". This is, strictly speaking, a Euclidean concept. It doesn't really translate to spherical (or other curved) surfaces. What are these centroids intended to represent?
    – whuber
    Feb 3 '16 at 19:39

For US-level analysis I usually use the USGS Albers Equal Area projection "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version".

proj4string: +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs


  • Could you explain why this would be expected to produce accurate centroids?
    – whuber
    Feb 3 '16 at 17:24
  • @Jeffrey Evans- The projection string for the "USA_Contiguous_Albers_Equal_Area_Conic_USGS_version", when viewed in R and QGIS do not have the +ellps=GR80 part. Why is that the case?
    – tg110
    Aug 22 '18 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.