Python Geopandas unable to convert latitude longitude to points

35 Views Asked by At

I have a dataframe from a CSV file with fields for latitude and longitude. I want to convert the df to a geodataframe of points with the lat and lon fields. When I map the points, the points show up in the wrong place (i.e., middle of the ocean).

I checked my gdf against another version of the gdf and confirmed that the lat/long fields and geometry fields are the same for observations with the same ID (this correct gdf is missing observations so I can't use it.) What am I missing? Thanks

Here is my code:

geometry = [Point(xy) for xy in zip(df['lon'], df['lat'])]
new_gdf = gpd.GeoDataFrame(df,crs='EPSG:4326',geometry=geometry)
new_gdf.to_crs('EPSG:2229',inplace=True) # convert to projection that I want to map in
new_gdf.plot()
0

There are 0 best solutions below