geo-adjacency


Namegeo-adjacency JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://asmyth01.github.io/geo-adjacency/
SummaryA package to determine which geometries are adjacent to each other, accounting for obstacles and gaps between features.
upload_time2023-12-07 04:13:08
maintainer
docs_urlNone
authorAndrew Smyth
requires_python>=3.9,<3.13
licenseMIT
keywords voronoi adjacency geospatial geometry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Geo-Adjacency
Pip [repository](https://pypi.org/project/geo-adjacency/)

Full [documentation](https://asmyth01.github.io/geo-adjacency/index.html)

# Installation
It's recommended to use a virtual environment to install this tool, since its dependencies may 
require different versions than what is installed on your system.

## pip
Recommended installation is with [pip](https://pypi.org/project/pip/):

```python -m pip install geo-adjacency```

## Build from source
You must have Python <3.13,>=3.9 installed.
```
$ git clone git@github.com:asmyth01/geo-adjacency.git
$ cd geo-adjacency
$ poetry install
```
Or with [build](https://pypa-build.readthedocs.io/en/latest/).
```
$ git clone git@github.com:asmyth01/geo-adjacency.git
$ cd geo-adjacency
$ python -m build
```

# Example Usage
_See the [docs](https://asmyth01.github.io/geo-adjacency/index.html) for details._

1.  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.
2. Create an AdjacencyEngine. In this case, we'll load the sample data which is available on `Github <https://github.com/asmyth01/geo-adjacency/>`_.

   ```python
   s, t, o = load_test_geoms("../tests/sample_data")
      engine = AdjacencyEngine(s , t, o, True)
   ```
3. Run the analysis
      ```python
      output = engine.get_adjacency_dict()
      # defaultdict(<class 'list'>, {0: [1, 2], 1: [1], 2: [1], 3: [2], 6: [1], 7: [1]})
      ```

    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.

4. You can visualize the output with a handy built-in method which uses pyplot.
   `engine.plot_adjacency_dict()`. (Source geoms are grey, targets are blue, obstacles are red. Linkages are green.

   ![adjancency diagram](docs/images/adjacency_with_segmentation.png) 

5.  You probably will want to match the adjacency dictionary back to the original data so that you can do something cool with it.
```python
      for source_i, target_i_list in output.items():
          source_geom = source_geometries[source_i]
          target_geoms = [target_geometries[i] for i in target_i_list]
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://asmyth01.github.io/geo-adjacency/",
    "name": "geo-adjacency",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<3.13",
    "maintainer_email": "",
    "keywords": "voronoi,adjacency,geospatial,geometry",
    "author": "Andrew Smyth",
    "author_email": "andrew.j.smyth.89@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/63/5a/92db2675829f8914bcfbc31f4fe5ae89dbac974e0dcb814069d7b2297942/geo_adjacency-1.1.2.tar.gz",
    "platform": null,
    "description": "# 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.13,>=3.9 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 <https://github.com/asmyth01/geo-adjacency/>`_.\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(<class 'list'>, {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\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to determine which geometries are adjacent to each other, accounting for obstacles and gaps between features.",
    "version": "1.1.2",
    "project_urls": {
        "Documentation": "https://asmyth01.github.io/geo-adjacency/",
        "Homepage": "https://asmyth01.github.io/geo-adjacency/",
        "Repository": "https://github.com/andrewsmyth/geo-adjacency"
    },
    "split_keywords": [
        "voronoi",
        "adjacency",
        "geospatial",
        "geometry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b7e12715136f88cc4fff58df49789c636aa70217377fdf673727317f4eded22",
                "md5": "ec4a0088c63593557db9a610ea7af8a7",
                "sha256": "564c2b94fa6ea8cae3dd254d6d29189228300d60fa4a97d2beece9a2b083b568"
            },
            "downloads": -1,
            "filename": "geo_adjacency-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ec4a0088c63593557db9a610ea7af8a7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<3.13",
            "size": 10424,
            "upload_time": "2023-12-07T04:13:06",
            "upload_time_iso_8601": "2023-12-07T04:13:06.619365Z",
            "url": "https://files.pythonhosted.org/packages/1b/7e/12715136f88cc4fff58df49789c636aa70217377fdf673727317f4eded22/geo_adjacency-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "635a92db2675829f8914bcfbc31f4fe5ae89dbac974e0dcb814069d7b2297942",
                "md5": "1fed361fb17c7199cf5b472bbdba9408",
                "sha256": "6398fb925e0290388be206528e74d8ae416094f09c869890161c580dc3d47c86"
            },
            "downloads": -1,
            "filename": "geo_adjacency-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1fed361fb17c7199cf5b472bbdba9408",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<3.13",
            "size": 10170,
            "upload_time": "2023-12-07T04:13:08",
            "upload_time_iso_8601": "2023-12-07T04:13:08.174744Z",
            "url": "https://files.pythonhosted.org/packages/63/5a/92db2675829f8914bcfbc31f4fe5ae89dbac974e0dcb814069d7b2297942/geo_adjacency-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-07 04:13:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "andrewsmyth",
    "github_project": "geo-adjacency",
    "github_not_found": true,
    "lcname": "geo-adjacency"
}
        
Elapsed time: 0.14978s