I've downloaded a world map and want to change it from the default CRS (EPSG:4326) to the WGS 84 / Pseudo-Mercator projection used in applications like Tableau and Google Maps (EPSG:3857). For some reason, when I attempt the transformation, the longitude and latitude numbers become inflated.
For example, (-95.160, -95.102) becomes (-10593226.108, -10586797.584)
library(rnaturalearth)
library(dplyr)
library(sf)
target_crs <- st_crs(3857)
# Use the United States as an example
US <- ne_countries(scale = 10, type = "countries", returnclass = "sf") %>%
filter(admin == "United States of America") %>%
select(admin, geometry)
head(US)
#Simple feature collection with 1 feature and 1 field
#Geometry type: MULTIPOLYGON
#Dimension: XY
#Bounding box: xmin: -179.1435 ymin: 18.90612 xmax: 179.7809 ymax: 71.4125
#CRS: +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
# admin geometry
#1 United States of America MULTIPOLYGON (((-95.16057 4...
# Now attempt to transform the CRS
US <- st_transform(US, target_crs)
head(US)
#Simple feature collection with 1 feature and 1 field
#Geometry type: MULTIPOLYGON
#Dimension: XY
#Bounding box: xmin: -19942160 ymin: 2143886 xmax: 20013120 ymax: 11544810
#Projected CRS: WGS 84 / Pseudo-Mercator
# admin geometry
#1 United States of America MULTIPOLYGON (((-10593226 6...
Notice the massive change in the xmin, ymin, xmax, ymax values. I'm not sure what's causing this.
3857
is in meter and 4326
are in degree. Are you close to peter island ?
You can test your coords here if needed : https://epsg.io/map#srs=3857&x=-10093891.770199&y=-10709420.049722&z=12&layer=streets