Fix pyproj database path


Thu Aug 18 2022 07:19:21 GMT+0000 (Coordinated Universal Time)

Saved by @ClemensBerteld #pyproj #python #database #path

'UserWarning: pyproj unable to set database path.' <- This happens with multiple pyproj installations on the same machine, which is quite common, as almost every geo software depends on it.

How to fix:
First, find all copies of 'proj.db' on the machine. Get the path for the correct one, which is probably something like 'C:/Users/Clemens Berteld/.conda/pkgs/proj-8.2.0-h1cfcee9_0/Library/share/proj'. Definitively not a QGIS or PostGIS path.

Then, use it as a parameter for this function and run it at the top of your code:

def set_pyproj_path(proj_path):
    from pyproj import datadir
    # print(datadir.get_data_dir.__doc__)