Data Directory#

pyproj.datadir.get_data_dir#

pyproj.datadir.get_data_dir() str[source]#

The order of preference for the data directory is:

  1. The one set by pyproj.datadir.set_data_dir (if exists & valid)

  2. The internal proj directory (if exists & valid)

  3. The directory in PROJ_DATA (PROJ 9.1+) | PROJ_LIB (PROJ<9.1) (if exists & valid)

  4. The directory on sys.prefix (if exists & valid)

  5. The directory on the PATH (if exists & valid)

Returns:

The valid data directory.

Return type:

str

pyproj.datadir.set_data_dir#

pyproj.datadir.set_data_dir(proj_data_dir: Union[str, Path]) None[source]#

Set the data directory for PROJ to use.

Parameters:

proj_data_dir (Union[str, Path]) – The path to the PROJ data directory.

pyproj.datadir.append_data_dir#

pyproj.datadir.append_data_dir(proj_data_dir: Union[str, Path]) None[source]#

Add an additional data directory for PROJ to use.

Parameters:

proj_data_dir (Union[str, Path]) – The path to the PROJ data directory.

pyproj.datadir.get_user_data_dir#

pyproj.datadir.get_user_data_dir(create=False)#

New in version 3.0.0.

Get the PROJ user writable directory for datumgrid files.

See: proj_context_get_user_writable_directory()

This is where grids will be downloaded when PROJ network capabilities are enabled. It is also the default download location for the projsync command line program.

Parameters:

create (bool, default=False) – If True, it will create the directory if it does not already exist.

Returns:

The user writable data directory.

Return type:

str