Huge impostor syndrome vibes, as I am working with this data frequently, but I still don't understand it.
I have a .geojson
file containing line features.
st_crs(streets_import)
Coordinate Reference System:
User input: WGS 84 / Pseudo-Mercator
wkt:
PROJCRS["WGS 84 / Pseudo-Mercator",
BASEGEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]],
CONVERSION["Popular Visualisation Pseudo-Mercator",
METHOD["Popular Visualisation Pseudo Mercator",
ID["EPSG",1024]],
PARAMETER["Latitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8801]],
PARAMETER["Longitude of natural origin",0,
ANGLEUNIT["degree",0.0174532925199433],
ID["EPSG",8802]],
PARAMETER["False easting",0,
LENGTHUNIT["metre",1],
ID["EPSG",8806]],
PARAMETER["False northing",0,
LENGTHUNIT["metre",1],
ID["EPSG",8807]]],
CS[Cartesian,2],
AXIS["easting (X)",east,
ORDER[1],
LENGTHUNIT["metre",1]],
AXIS["northing (Y)",north,
ORDER[2],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["unknown"],
AREA["World - 85°S to 85°N"],
BBOX[-85.06,-180,85.06,180]],
ID["EPSG",3857]]
I need it to be in 4326, and so I naturally do:
st_transform(streets_import, 4326)
However, the result of this is that all coordinates re-set to (0,0) in my lower left corner.
If, on the other hand, I set the crs, I get the correct behavior:
st_crs(streets_import) <- 4326
Everything else works as expected now, but I have a feeling I've done something wrong.
My question is why st_transform()
behaves this way, resetting coords to zero?
(Bonus question: I am really confused by the difference between EPSG 4326 and 3857. Like, one is geographic and one is projected, but both of them capture all/most of the Earth and use the same numeric values for coordinates - absolute lat and long. Where am I confused?)
(I can provide a reprex, but I felt like this question is simple enough for someone to explain to me without needing a reprex. In other words, it's not an issue with data and it is something obvious to most geospatial professionals)