Converting CRS with geopandas gives wrong coordinate values

67 views Asked by At

I'm trying to convert a bunch of geometries using geopandas from EPSG:4326 (wgs84) to EPSG:31370 (belgium lambert 72)

I was trying a small test but the coordinates that I get are incorrect.

import shapely
import geopandas as gpd

#Some location in Belgium
point1 = shapely.geometry.Point(51.2, 3.2)
row = {"z": [2.1], "geometry": [point1]}

#Assign crs to wgs84
point_wgs = gpd.GeoDataFrame(row, crs=4326)

point_bel = point_wgs.to_crs(31370)

I'm getting coordinates 6684560.556, -3548962.482 as a result, but the correct coordinates should be something around 68000, 210000. I tried with pyproj as well as

from pyproj import Transformer
transformer = Transformer.from_crs("EPSG:4326", "EPSG:31370")
belgian_point = transformer.transform(point_wgs.iloc[0].geometry.x, point_wgs.iloc[0].geometry.y)

And Im getting the correct result. What's going on?

I would like to use geopandas since I have multiple different features.

0

There are 0 answers