Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/worldbank/gostnets
Convenience wrapper for networkx analysis using geospatial information, focusing on OSM
https://github.com/worldbank/gostnets
network-analysis openstreetmap worldbank worldbank-gost
Last synced: 2 months ago
JSON representation
Convenience wrapper for networkx analysis using geospatial information, focusing on OSM
- Host: GitHub
- URL: https://github.com/worldbank/gostnets
- Owner: worldbank
- License: mit
- Created: 2019-06-17T18:31:55.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-13T19:33:34.000Z (8 months ago)
- Last Synced: 2024-04-14T09:53:20.077Z (8 months ago)
- Topics: network-analysis, openstreetmap, worldbank, worldbank-gost
- Language: Python
- Homepage: https://worldbank.github.io/GOSTnets/
- Size: 74.6 MB
- Stars: 20
- Watchers: 26
- Forks: 15
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GOSTnets: Build, process, and analyze networks
[GOSTnets](https://github.com/worldbank/GOSTnets) is built on top of geopandas, networkx, osmnx, and rtree.
## Installation
### From PyPI
#### *pypi support in development*
### From `conda-forge`
#### *conda support in development*
### From Source
1. Clone or download this repository to your local machine. Then, navigate to the root directory of the repository:
```shell
git clone https://github.com/worldbank/GOSTnets.git
cd GOSTnets
```2. Create a virtual environment (optional but recommended):
```shell
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
```3. Install the package in editable mode with dependencies:
```shell
pip install -e .
```The `-e` flag stands for "editable," meaning changes to the source code will immediately affect the installed package.
## Alternative Installations With Optional Dependencies
The following are optional dependencies that can be installed with [GOSTnets](https://github.com/worldbank/GOSTnets) - which not required to use [GOSTnets](https://github.com/worldbank/GOSTnets), but they may be useful for some users, as they enable additional functionality. All of these alternative installs use the same `pip install` command as above. The examples show how to install these from PyPI, but the same commands can be used to install from source, replacing the package name `GOSTnets` with a `.` similar to the example above.
### OSM Support (Needed to run functions from `load_osm.py`)
```shell
pip install GOSTnets[osm]
```### Optimization Support (Needed to run functions from `optimization.py`)
```shell
pip install GOSTnets[opt]
```### Development Support
```shell
pip install GOSTnets[dev]
```## Usage
Every function contains a docstring which can be brought up in use to check the inputs for various functions. For example:
```python
import GOSTnets as gn
gn.edge_gdf_from_graph?
```returns:
```python
Signature: gn.edge_gdf_from_graph(G, crs={'init': 'epsg:4326'}, attr_list=None, geometry_tag='geometry', xCol='x', yCol='y')
#### Function for generating a GeoDataFrame from a networkx Graph object ###
REQUIRED: a graph object G
OPTIONAL: crs - projection of format {'init' :'epsg:4326'}. Defaults to
WGS84. Note: here we are defining the crs of the input geometry -
we do NOT reproject to this crs. To reproject, consider using
geopandas' to_crs method on the returned gdf.
attr_list: list of the keys which you want to be moved over to
the GeoDataFrame.
geometry_tag - the key in the data dictionary for each edge which
contains the geometry info.
xCol - if no geometry is present in the edge data dictionary, the
function will try to construct a straight line between the start
and end nodes, if geometry information is present in their data
dictionaries. Pass the Longitude info as 'xCol'.
yCol - likewise, determining the Latitude tag for the node's data
dictionary allows us to make a straight line geometry where an
actual geometry is missing.
RETURNS: a GeoDataFrame object of the edges in the graph
#-------------------------------------------------------------------------#
```These docstrings have been written for every function, and should help new and old users alike with the options and syntax.
## License
This licensed under the [**MIT License**](https://opensource.org/license/mit). This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.