I managed to convert my set of coordinates projected in EPSG:4326 to EPSG:3857, however, the result does not match with the ones I get at
https://epsg.io/transform#s_srs=4326&t_srs=3857&x=14.5172200&y=46.0658300 or directly in ArcGIS, although the specifics of the EPSG systems provided in r (see the script below) match up with the description in the GIS software.
I have tried it with the following code:
library("rgdal", lib.loc="~/Library/R/3.4/library")
orig_coords <- data.frame(lat=c(46.065830, 46.042211, 46.094612), lon=c(14.517220, 14.487756, 14.597046))
coordinates(orig_coords) <- c('lat', 'lon')
#Determine the projection of the lat-long coordinates, by default it is EPSG:4326
proj4string(orig_coords) <- CRS("+init=epsg:4326")
print(summary(orig_coords))
#Convert the coordinates to the used metric system (EPSG:3857)
Metric_coords<-spTransform(orig_coords,CRS("+init=epsg:3857"))
print(summary(Metric_coords))
The correct coordinates would be
5790904.807 1616049.538;
5787116.145 1612769.621;
5795523.844 1624935.728;
Instead, I get:
lat - lon;
[1,] 5128025 1633624;
[2,] 5125395 1630236;
[3,] 5131229 1642804;
I cannot find where the problem is...