A lightweight Python package that converts Esri File GeoDataBases into OGC GeoPackages
Project description
fgdb_to_gpkg
fgdb_to_gpkg is a Python package that converts all feature classes within an Esri File GeoDatabase to layers within a OGC GeoPackage. This package is designed to be used from the command line or imported as a module.
This package does not have a dependency on ArcPy, which means that you can safely extract feature classes locked inside an Esri File GeoDataBase without needing to worry about any ArcGIS licensing.
Prerequisites
This package requires GDAL and its development libraries to be installed on your system before installing fgdb_to_gpkg or its dependencies. For more details please refer to the official documentation.
To confirm GDAL is installed, run:
gdalinfo --version
# GDAL 3.8.4, released 2024/02/08
Installation
Installing from PyPI
# Recommended: Install globally using pipx
pipx install fgdb-to-gpkg
# Or install to a manually-created virtual environment
python -m venv env
./env/bin/pip install fgdb-to-gpkg
# Or install to the global Python environment
pip install fgdb-to-gpkg
Installing the development version of this package
- Clone the repository:
git clone https://github.com/philiporlando/fgdb_to_gdb.git - Navigate to the repository directory:
cd fgdb_to_gdb - Install the package and its dependencies with uv:
uv sync --group dev
- Optionally, install the package to be run globally with pipx:
pipx install --editable .
Usage
Command Line Usage
To use from the command line, simply call the fgdb-to-gpkg command with the path to the input File GeoDatabase and the path to the output GeoPackage:
fgdb-to-gpkg <input_fgdb_path> <output_gpkg_path>
See the help menu for more details:
fgdb-to-gpkg --help
Module Usage
You can also import fgdb_to_gpkg as a module in Python and use it to convert any Esri File GeoDatabase feature classes to GeoPackage layers programmatically.
Here's an example of how to use fgdb_to_gpkg as a module:
from fgdb_to_gpkg import fgdb_to_gpkg
input_fgdb_path = "/path/to/my_fgdb.gdb"
output_gpkg_path = "/path/to/my_gpkg.gpkg"
fgdb_to_gpkg(input_fgdb_path, output_gpkg_path)
See the help menu for more details:
help(fgdb_to_gpkg)
Testing
Unit tests can be performed by the developers of this package using the following command:
uv run pytest
Test coverage can be assessed using the following command:
uv run pytest --cov=fgdb_to_gpkg --cov-report term-missing
Handling the Fiona GDAL compilation error
The unit tests within this package depend on gdal=^3.6.0, but the current version of fiona ships with gdal=3.5.3. The fiona package must be installed using the --no-binary flag to test this package. If this is not configured properly, then you will see the following error:
uv run tests
# fiona.errors.DriverError: OpenFileGDB driver requires at least GDAL 3.6.0 for mode 'w', Fiona was compiled against: 3.5.3
If you encounter errors related to GDAL or Fiona compatibility, ensure you have the correct versions installed and that your environment is synced using uv. If you still encounter issues, try reinstalling Fiona with:
uv pip install --force-reinstall fiona --no-binary fiona
Publishing
This package is automatically published to PyPI when a new release is crafted. For a successful publication, maintainers should:
- Increment the version number in the
pyproject.tomlfile. - Adhere to the
vX.X.Xnaming convention for the release name and tag.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fgdb_to_gpkg-0.4.5.tar.gz.
File metadata
- Download URL: fgdb_to_gpkg-0.4.5.tar.gz
- Upload date:
- Size: 77.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc8226d807f2d9a13ed2b64355ee9947de788d94480e101428b69c285aa87d31
|
|
| MD5 |
eec489517abd1447bc645d3d584ff9f9
|
|
| BLAKE2b-256 |
be5cee923777bf51e541622f17a4b61c40e0726a8bbb5ef6bf3695b620609ab0
|
File details
Details for the file fgdb_to_gpkg-0.4.5-py3-none-any.whl.
File metadata
- Download URL: fgdb_to_gpkg-0.4.5-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3f78b672d612e30bcf17760a8ae6144157efcc9de91b37c1f2e6d0d75c7d45b
|
|
| MD5 |
9ce68f622a13092a648b9e9f03d2a5cb
|
|
| BLAKE2b-256 |
8da914818021380c67d7722535355c4c898b2c70d5547ed8756d5a4e6d22b906
|