Skip to content

Commit

Permalink
Merge pull request #28 from brandones/add-cli
Browse files Browse the repository at this point in the history
Add executable cli/script/bin fgdb-to-gpkg (fixes #26)
  • Loading branch information
philiporlando authored Nov 23, 2024
2 parents e87fbd7 + 9d8e990 commit cf0b7d0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ This package does not have a dependency on ArcPy, which means that you can safel
#### 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
```

Expand All @@ -17,15 +25,16 @@ pip install fgdb-to-gpkg
1. Clone the repository: `git clone https://github.com/philiporlando/fgdb_to_gdb.git`
2. Navigate to the repository directory: `cd fgdb_to_gdb`
3. Install the package and its dependencies with [poetry](https://python-poetry.org/): `poetry install`
4. Optionally, install the package to be run globally with pipx: `pipx install --editable .`

## Usage

### Command Line Usage

To use `fgdb_to_gpkg` 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:
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:

```
poetry run python -m fgdb_to_gpkg <input_fgdb_path> <output_gpkg_path>
fgdb-to-gpkg <input_fgdb_path> <output_gpkg_path>
```

### Module Usage
Expand Down
2 changes: 2 additions & 0 deletions fgdb_to_gpkg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
fgdb_to_gpkg,
get_layer_lists,
remove_gpkg_if_overwrite,
main,
)

__all__ = [
"remove_gpkg_if_overwrite",
"get_layer_lists",
"convert_layer",
"fgdb_to_gpkg",
"main",
]
6 changes: 5 additions & 1 deletion fgdb_to_gpkg/fgdb_to_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def fgdb_to_gpkg(
raise


if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(
description="Convert an Esri File GeoDatabase to a GeoPackage"
)
Expand All @@ -135,3 +135,7 @@ def fgdb_to_gpkg(

args = parser.parse_args()
fgdb_to_gpkg(args.fgdb_path, args.gpkg_path, args.overwrite)


if __name__ == "__main__":
main()
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ geodatasets = "^2024.7.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
fgdb-to-gpkg = "fgdb_to_gpkg:main"

0 comments on commit cf0b7d0

Please sign in to comment.