Geopandas to_crs gives wrong coordinates after transformation

Question:

I am trying to plot a shapefile as points a Folium map but am pulling my hair out trying to get the projection correct. The data is in the EPSG:28992 system, the RD new coordinate system. This is a projected coordinate system, thus it gives coordinates in meters. To plot this on a folium map I need to convert it to EPSG:3857, which works with degrees if I am correct. Unfortunately I am getting complete nonsense after converting it with the function to_crs().

First I load the data:

import geopandas

WTG = geopandas.read_file('WTGs.shp')

print(WTG.head()) shows this:

  TEXTSTRING       geometry
0     A27-09       POINT (151809.960 484552.520)

Which is correct. It also has the right CRS, as shown by the output of print(WTG.crs):

epsg:28992

Now to convert this to the other CRS I use the following simple code:

WTG = WTG.to_crs(epsg=3857)

But now checking the result with print(WTG.head()) gives complete nonsense for the geometry column.

  TEXTSTRING       geometry
0     A27-09       POINT (594489.076 6863453.514)

The geometry points should be in degrees. In other words, the coordinates should be around 52 and 5.
The output of print(WTG.crs) is correct though:

epsg:3857

Does any of you know how to fix this? Or am I missing something? Thanks in advance!

Asked By: jcnc

||

Answers:

EPSG 3857 is not in degrees but in meters, so there is no reason to assume that transformation is wrong. If you want degrees, you need 4326.

The point is located in north of Utrecht, is that correct? If so, everything works as intended.

Answered By: martinfleis