I have a set of points for Italian cities in UTM 32 N (CRS=EPSG:32632) and I have computed the distances between them using R.

Now I would like to compute linear distances also between a subgroup of these Italian cities and world countries, using their centroids as reference points.

The centroids coordinates I have found for world countries use EPSG:4326 WGS 84 as the reference system.

Now I'm wondering what is the best way to combinate these two sets of coordinates and compute distances. If I have correctly understood I can not use the UTM 32 N for other zones.

Should I convert the Italian coordinates into EPSG:4326 WGS 84?

1 Answer 1


"Should I convert the Italian coordinates into epsg:4326 wgs84?"

Yes. You should be using the sf package for spatial data, and use st_transform to convert between coordinate systems. Then the st_distance function will compute the distance along the surface of the earth as a spherical or ellipsoidal model. Details in the help.

You could also recompute your city distances using spherical distances, you may find small differences between the spherical distance and the planar distance in UTM coordinates, which will be greatest for cities far apart.

  • I have used this specification from the italian cities utm coordinates: utm = st_as_sf(comuni,coords = c("X_WGS84_32N", "Y_WGS84_32N"), crs="32632") . Is it correct to use crs = 4326 in the st_transform function?Thank you
    – ggg
    Commented Feb 7, 2023 at 15:37
  • 1
    Yes, coordinate reference systems can be referred to in the sf package as numbers or character strings. A numeric crs like 4326 is equivalent to a character crs like "EPSG:4326".
    – Spacedman
    Commented Feb 7, 2023 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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