{"id":15046520,"url":"https://github.com/asmyth01/geo-adjacency","last_synced_at":"2026-02-04T01:43:30.206Z","repository":{"id":208937713,"uuid":"721450753","full_name":"asmyth01/geo-adjacency","owner":"asmyth01","description":"A robust and versatile package for calculating adjacency relationships between geometries, taking obstacles into account. Useful whenever a simple intersection isn't good enough.","archived":false,"fork":false,"pushed_at":"2023-12-26T19:13:32.000Z","size":9179,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T06:31:45.549Z","etag":null,"topics":["adjacency","geography","geolocation","geometry","geospatial","gis","location","matplotlib","matplotlib-pyplot","numpy","scipy","shapely","spatial","spatial-analysis","spatial-data","spatial-data-analysis","voronoi","voronoi-diagram"],"latest_commit_sha":null,"homepage":"https://asmyth01.github.io/geo-adjacency/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asmyth01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-21T04:49:21.000Z","updated_at":"2024-10-16T04:42:52.000Z","dependencies_parsed_at":"2023-12-26T20:56:09.378Z","dependency_job_id":"ac42c7e7-35ba-4337-800a-74f59dab4c8f","html_url":"https://github.com/asmyth01/geo-adjacency","commit_stats":{"total_commits":71,"total_committers":2,"mean_commits":35.5,"dds":"0.028169014084507005","last_synced_commit":"7bd89a0ff14d6a8490b7db8d197c3f488781307d"},"previous_names":["asmyth01/geo-adjacency"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmyth01%2Fgeo-adjacency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmyth01%2Fgeo-adjacency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmyth01%2Fgeo-adjacency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmyth01%2Fgeo-adjacency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asmyth01","download_url":"https://codeload.github.com/asmyth01/geo-adjacency/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238508846,"owners_count":19484214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adjacency","geography","geolocation","geometry","geospatial","gis","location","matplotlib","matplotlib-pyplot","numpy","scipy","shapely","spatial","spatial-analysis","spatial-data","spatial-data-analysis","voronoi","voronoi-diagram"],"created_at":"2024-09-24T20:53:11.801Z","updated_at":"2026-02-04T01:43:30.200Z","avatar_url":"https://github.com/asmyth01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Geo-Adjacency\nPip [repository](https://pypi.org/project/geo-adjacency/)\n\nFull [documentation](https://asmyth01.github.io/geo-adjacency/index.html)\n\n# Installation\nIt's recommended to use a virtual environment to install this tool, since its dependencies may \nrequire different versions than what is installed on your system.\n\n## pip\nRecommended installation is with [pip](https://pypi.org/project/pip/):\n\n```python -m pip install geo-adjacency```\n\n## Build from source\nYou must have Python 3.10-3.14 installed.\n```\n$ git clone git@github.com:asmyth01/geo-adjacency.git\n$ cd geo-adjacency\n$ poetry install\n```\nOr with [build](https://pypa-build.readthedocs.io/en/latest/).\n```\n$ git clone git@github.com:asmyth01/geo-adjacency.git\n$ cd geo-adjacency\n$ python -m build\n```\n\n# Example Usage\n_See the [docs](https://asmyth01.github.io/geo-adjacency/index.html) for details._\n\n1.  Load the data. geo-adjacency expects you to provide your data as Shapely geometries. You will provide three lists: source_geoemtries, target_geometries, and obstacle_geometries. What we are analyzing is which of the source geometries are adjacent to which of the target geometries. Obstacles can prevent a source and target from being adjacent, but they do not participate in the adjacency dictionary.\n2. Create an AdjacencyEngine. In this case, we'll load the sample data which is available on `Github \u003chttps://github.com/asmyth01/geo-adjacency/\u003e`_.\n\n   ```python\n   s, t, o = load_test_geoms(\"../tests/sample_data\")\n      engine = AdjacencyEngine(s , t, o, True)\n   ```\n3. Run the analysis\n      ```python\n      output = engine.get_adjacency_dict()\n      # defaultdict(\u003cclass 'list'\u003e, {0: [1, 2], 1: [1], 2: [1], 3: [2], 6: [1], 7: [1]})\n      ```\n\n    The output is a dictionary. Keys are the indices of source geometries in the input list, and values are a list of indices of adjacent target geometries in the input list.\n\n4. You can visualize the output with a handy built-in method which uses pyplot.\n   `engine.plot_adjacency_dict()`. (Source geoms are grey, targets are blue, obstacles are red. Linkages are green.\n\n   ![adjancency diagram](docs/images/adjacency_with_segmentation.png) \n\n5.  You probably will want to match the adjacency dictionary back to the original data so that you can do something cool with it.\n```python\n      for source_i, target_i_list in output.items():\n          source_geom = source_geometries[source_i]\n          target_geoms = [target_geometries[i] for i in target_i_list]\n```\n\n# Development\n## Installing dependencies\n```\npoetry env use [python version]\npoetry install\n```\n\n## Running tests\n`poetry run pytest tests`\n\n## Running a module\n`poetry run python [python file]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmyth01%2Fgeo-adjacency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasmyth01%2Fgeo-adjacency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmyth01%2Fgeo-adjacency/lists"}