i have two geodata frames in geopandas that are not aligning

37 Views Asked by At

I am mapping my location history using Geopandas during a timeframe where I travelled from NYC (which I started working with and was able to map out) to Ithaca (upstate). My location history points show that I travelled to Ithaca but when I tried adding Ithaca's geodata file the location points and the map plot do not align.

I think there might be an issue with projection- but I don't know what exactly or how to fix it.

enter image description here

1

There are 1 best solutions below

0
Ratislaus On

You could start with checking the CRS of your geodata files. For example, if the file with your location history points is history.shp, then you can check it like this in Python:

>>> import geopandas
>>> gdf = geopandas.read_file("history.shp")
>>> print(gdf.crs)
epsg:31467

Do the same with the map file. If the map has a different CRS, say epsg:4326, then you could transform the CRS of your history geodata frame to epsg:4326 like this:

>>> gdf.to_crs(epsg='4326', inplace=True)

Then you could try to plot both of your geo data frames on the same axes.