Geo-NX : Geospatial Network Analysis 
Geo-NX is a Python package for the creation, manipulation, and study of geospatial networks.
Geo-NX extends NetworkX operations to allow operations on geometric types.
The Geo-NX package was created as part of the Qualicharge project
Description
Geo-NX combines the capabilities of NetworkX, GeoPandas and shapely :
- NetworkX is the core of Geo-NX,
- GeoPandas is the support for vectorized processing,
- Geo-NX uses shapely for geometry analysis and manipulation
Documentation is available at https://loco-labs.github.io/geo_nx/
Data structures
geo_nx.GeoGraph is a subclass of networkx.Graph with additional data:
- 'crs': coordinate reference system,
- 'geometry': geospatial representation of nodes and edges.
A geo_nx.GeoGraph has two representations:
- a
networkx.Graphrepresentation where 'crs' is a graph attribute and 'geometry' is a node and edge attribute (shapely object), - a
geopandas.GeoDataFramerepresentation for the nodes and for the edges where columns are id (node or edge) and attributes.
Example
Simple distance from Paris to Marseille
In [1]: import geo_nx as gnx
paris = Point(2.3514, 48.8575)
lyon = Point(4.8357, 45.7640)
marseille = Point(5.3691, 43.3026)
bordeaux = Point(-0.56667, 44.833328)
In [2]: simplemap = gpd.GeoDataFrame({
'geometry': [
LineString([paris, lyon]),
LineString([lyon, marseille]),
LineString([paris, bordeaux]),
LineString([bordeaux, marseille])
]}, crs=4326).to_crs(2154)
In [3]: gr_simplemap = gnx.from_geopandas_edgelist(simplemap)
In [4]: gr_simplemap.to_geopandas_nodelist()
Out[4]:
geometry node_id
0 POINT (652411.148 6862135.813) 0
1 POINT (842666.659 6519924.367) 1
2 POINT (892313.068 6247711.351) 3
3 POINT (418208.312 6421272.355) 2
In [5]: # 0: paris, 1: lyon, 2: bordeaux, 3: marseille
# weight is a calculated attribute (length of a geometry)
nx.shortest_path(gr_simplemap, source=0, target=3, weight='weight')
Out[5]: [0, 1, 3]
In [6]: nx.shortest_path_length(gr_simplemap, source=0, target=3, weight='weight')
Out[6]: 668246.1446978811
Install
Install the latest released version of Geo-NX:
pip install geo_nx
Bugs
Please report any bugs that you find here. Or, even better, fork the repository on GitHub and create a pull request (PR).
Metadata
Release files for geo-nx 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| geo_nx-0.2.0.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geo_nx-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.6 kB
Release files / geo_nx-0.2.0.tar.gz
| Download URL | geo_nx-0.2.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c408a0ffa33055997331c418a96def5dd75463b0993d82e408aa93cb9c1e93fc
|
|
BLAKE2b-256 checksum How to use checksums |
a5dd25f692acebf99d95b7c09eba293cafcd9fff53fa4e83e36260605f386d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / geo_nx-0.2.0-py3-none-any.whl
| Download URL | geo_nx-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64be18684f12d5c7ed85d6e3f5b6d2cda0442e7fb353cd8700168abc1304ab61
|
|
BLAKE2b-256 checksum How to use checksums |
2d0cc85fb98e7410af89df5b0ffb980ea86bf0f22c5642236e8e353c618bc6e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|