I have a geopandas dataframe that has POINT geometry in NAD83. I want to use to_crs to change them to espg: 4326. When I first bring in the feature class as a gpd dataframe, it shows no crs, so I use a function to find the source crs and then assign it to the dataframe (my understanding is that to use to_crs it has to already be assigned to a crs).

bldg_feat_cent_df = gpd.read_file(bldg_cent_cb_intersects_gdb, layer=state_bldg_centroid)
bldg_feat_cent_df.crs = {'init' :'+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs'}
>>>'+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs '

Now that its in a crs, I simply want to apply to_crs. I've tried this a couple of different ways, including inplace=True but I still get the same error:

bldg_reproj = bldg_feat_cent_df.to_crs({'init': 'epsg:4326'})

> RuntimeError: b'no arguments in initialization list'

I had a similar issue trying to use pyproj and it seems like the 2 are related. Conda shows that my pyproj version is 1.96. How can achieve my goal and resolve this issue?

Update: As requested, here's the output when I run the above line:

enter image description here

  • 1
    It's propably because pyproj cannot find the crs data, for some reason. Can you show the result of geopandas.show_versions() (in case you have geopandas 0.6.0) ? Can you give some more details about your OS, how you installed those packages (new environment, from conda-forge?) Maybe show the output of conda info – joris Oct 11 '19 at 16:13
  • It seems like the crux of this problem is related to the fact that it can't properly read the crs I am assigning it to initially: '+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs ' – gwydion93 Oct 11 '19 at 18:34
  • Can you try if import pyproj; pyproj.set_datapath("~AppData/Local/conda/conda/envs/geo_env/share/proj") helps? (best check that the path is correct and exists, I might have made a typo) – joris Oct 11 '19 at 18:48

The issue you are running into is a pyproj 1x issue.

I would recommend installing pyproj 2+. You can do this with conda using the conda-forge channel:

conda config --add channels conda-forge
conda config --add channels conda-forge
conda config --set channel_priority strict
conda create -n geo geopandas
conda activate geo

Or, you can install the latest version with python wheels:

pip install --ignore-installed pyproj==2.4.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.