简体   繁体   中英

CRS invalid projection

When I try this function, I get an error.

gdf = gpd.GeoDataFrame(df, geometry = "Coordinates", crs=4326)

CRSError: Invalid projection: epsg:4326: (Internal Proj Error: proj_create: SQLite error on SELECT name, type, coordinate_system_auth_name, coordinate_system_code, datum_auth_name, datum_code, area_of_use_auth_name, area_of_use_code, text_definition, deprecated FROM geodetic_crs WHERE auth_name =? AND code =?: no such column: area_of_use_auth_name)

It worked fine last time, but when I tried running today, it gave me this error. Help would be appreciated!

Your installation of pyproj does not see the correct database. See https://pyproj4.github.io/pyproj/stable/gotchas.html#internal-proj-error-sqlite-error-on-select .

This often happens if you start Jupyter in one environment and change the kernel. The link to PROJ database remains the same which may cause troubles.

For example, let's assume that I have started Jupyter lab in geo_env environment and then switched kernel to development environment and got the error as you did.

I can check my proj dictionary:

>>> import pyproj
>>> pyproj.datadir.get_data_dir()
'/opt/miniconda3/envs/geo_env/share/proj'

See that it still links to the env I started Jupyter with. I can fix that by specifying the correct path.

>>> pyproj.datadir.set_data_dir('/opt/miniconda3/envs/development/share/proj')

The situation is analogous in any other case when you see this error. You just have to specify the correct path to proj .

Hello I had the same problem for a couple of days. The problem comes from the library Pyproj. The following points solved my problem:

  1. Create a total new conda enviroment:
conda config --prepend channels conda-forge
conda config --set channel_priority strict
conda create -n pyproj_env pyproj
conda activate pyproj_env
  1. Create a new project using this new enviroment

  2. Install geopandas using conda

I solved my problem specifying the package's versions when creating the environment.

  1. To check which version you are using in your current environment: look into this file ...anaconda3\envs\<ENV>\conda-meta\proj-<VERSION>-h1cfcee-<VERSION>.json
  2. Create the new environment, with lower versions: $ conda create --name udl_report_env python==3.9.7 pyproj==3.3.0 proj==8.2.0 These versions are selected because I had some dependencies to cover, yours could be different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM