No project description provided
Project description
Geo-Adjacency
Pip repository
Full documentation
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:
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.
$ git clone git@github.com:asmyth01/geo-adjacency.git
$ cd geo-adjacency
$ python -m build
Example Usage
See the docs for details.
-
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.
-
Create an AdjacencyEngine. In this case, we'll load the sample data which is available on
Github <https://github.com/asmyth01/geo-adjacency/>_.s, t, o = load_test_geoms("../tests/sample_data") engine = AdjacencyEngine(s , t, o, True)
-
Run the analysis
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.
-
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. -
You probably will want to match the adjacency dictionary back to the original data so that you can do something cool with it.
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]
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geo_adjacency-1.0.7.tar.gz.
File metadata
- Download URL: geo_adjacency-1.0.7.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b674b024e13ff5490aecb0533c98f31b7181fb1d2d941af284b57846bf967ae
|
|
| MD5 |
31caff80edb5802e83d7c2db66f9cc53
|
|
| BLAKE2b-256 |
dc13610776509537bea484fcde7d0435f7d82554bb2a6fdb57e748286e68c9a2
|
File details
Details for the file geo_adjacency-1.0.7-py3-none-any.whl.
File metadata
- Download URL: geo_adjacency-1.0.7-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7961b52d051ba9f08b0e0365e725e0297b67fd267d42cad948e469387b7162c8
|
|
| MD5 |
23a3255cbd7d1e7c055c2f86d72d261f
|
|
| BLAKE2b-256 |
3a3e802c4451b0ec9b03ad04df9a2d641022eb5d5f776a5542f73259bba20e1a
|