I am working with GeoPandas and a Point GeoDataFrame. I have data points in WGS84 (EPSG=4326) that are located in New Zealand. I am trying to project them to a local UTM, but I cannot get the
geometry of the GeoDataFrame to update with the new UTM coordinates.
Here is an example GeoDataFrame:
import geopandas as gpd from pyproj import CRS long = [172.083916, 172.086549, 172.093403] lat = [-43.594391, -43.594758, -43.595249] gdf_pt = gpd.GeoDataFrame(geometry=gpd.points_from_xy(long, lat)) gdf_pt.crs = 4326 display(gdf_pt) print(gdf_pt.crs)
Failed Attempt #1 to project to EPSG=2193
myproject = gdf_pt.copy() myproject.crs = 2193 print(myproject.crs) display(myproject)
Failed Attempt #2
myproject['geometry'] = myproject['geometry'].to_crs(epsg=2193) display(myproject)
I also tried it with EPSG=32759, another suitable NZ UTM... same issue
What am I doing wrong?