Skip to content

corbel-spatial/ouroboros

Repository files navigation

Conda - Version PyPI - Version PyPI - Python Version PyPI Downloads License: MIT

Actions Workflow Status: Test Python Prerelease GitHub Actions Workflow Status: Linux GitHub Actions Workflow Status: Windows GitHub Actions Workflow Status: macOS GitHub Actions Workflow Status: Black GitHub Actions Workflow Status: Pylint Dynamic JSON Badge

ouroboros

Introduction

ouroboros is a Python module that provides helpful functions and classes for manipulating spatial data stored in a File GeoDatabase.

The data (.gdb) are read from disk into memory as FeatureClass objects, using GeoPandas under the hood for efficient analysis and easy conversion to other spatial data formats. FeatureClass objects can exist on their own, or they can be grouped into FeatureDataset and GeoDatabase objects which can be accessed like dictionaries. For example:

>>> import ouroboros as ob

# Explore an existing dataset

>>> gdb_file = "spam_and_eggs.gdb"
>>> ob.list_datasets(gdb_file)
{'egg_dataset': ['eggs_fc', 'bad_eggs_fc'],
{'spam_dataset': ['spam_fc'],
 None: ['ham_fc']}

# Load a feature class and convert to GeoPandas

>>> fc = ob.FeatureClass("spam_and_eggs.gdb/egg_dataset/eggs_fc")
>>> gdf = fc.to_geodataframe()
>>> type(gdf)
<class 'geopandas.geodataframe.GeoDataFrame'>

# Assemble a new geodatabase in memory

>>> gdb = ob.GeoDatabase()
>>> gdb['good_egg_dataset'] = ob.FeatureDataset()
>>> gdb['good_egg_dataset']['eggs_fc'] = ob.FeatureClass("spam_and_eggs.gdb/eggs_fc")

# Save geodatabase to disk

>>> gdb.save("good_eggs.gdb")
>>> ob.list_datasets("good_eggs.gdb")
{'good_egg_dataset': ['eggs_fc'], None: []}

Getting Started

About

ouroboros is released under a permissive open source license, it builds on mature open source GIS projects like GDAL, and importantly it does not use Esri's arcpy. Therefore, ouroboros does not require any paid licenses and it runs on macOS and Linux as well as Windows.

The main goal of this project is to allow traditional GIS users working primarily in the Esri/ArcGIS ecosystem to take advantage of the features and speed offered by modern data science tools. Second, it will provide a no-cost and user-friendly way to convert geodatabases to open data formats. And along the way, this project aims to develop a suite of tools that align with pythonic design principles, and also bring a little more joy and beauty to the task of wrangling spatial data.

Notes

  • ⚠️ This project is under active development and things may change without notice. Feedback, suggestions, and questions are welcomed in the Issues section.

  • Tested on Python 3.10, 3.11, 3.12, and 3.13 on the latest Windows, Linux, and macOS (version info here).