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.
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 poetry:
poetry install
- 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:
poetry run pytest tests
Test coverage can be assessed using the following command:
poetry 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:
poetry run pytest tests
# fiona.errors.DriverError: OpenFileGDB driver requires at least GDAL 3.6.0 for mode 'w', Fiona was compiled against: 3.5.3
The poetry.toml
file should contain all of the config needed to tell poetry how to handle this issue. However, if poetry install
does not resolve the issue, then try the following:
poetry run 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.toml file. Ensure you update it in both the [project] and [project.dependencies] sections.
-
Adhere to
vX.X.X
the naming 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
File details
Details for the file fgdb_to_gpkg-0.3.1.tar.gz
.
File metadata
- Download URL: fgdb_to_gpkg-0.3.1.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac5943fe3b805e24643d1ed246a15b6d44d5412948801913f2a5fe6af496e8e7 |
|
MD5 | 93da209a59361bbeb96f7fd6672266d4 |
|
BLAKE2b-256 | a931302a6d6ed9ed98c53d79cc58260d3c78955fc7c18693bf3d878f00f9f560 |
File details
Details for the file fgdb_to_gpkg-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: fgdb_to_gpkg-0.3.1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a06ccb38ddae9cc7034c22d99ccd6a8e9a3ed0d41e2082103ade8842292470f |
|
MD5 | c56003e3587f0c6465833deaf82e620f |
|
BLAKE2b-256 | ee6e3cd55fc35d86cdea2502dcae55f637239c438aa348fb4b0a99d33841fbdf |