Metadata-Version: 2.1
Name: GOSTnets
Version: 1.2.1
Summary: Network wrapper to simplify network analysis using geospatial data
Author-email: World Bank <github@worldbank.org>
Maintainer-email: "Benjamin P. Stewart" <bstewart@worldbankgroup.org>, Andres Chamorro <achamorroelizond@worldbank.org>
Project-URL: Homepage, https://github.com/worldbank/GOSTnets
Project-URL: Bug Reports, https://github.com/worldbank/GOSTnets/issues
Project-URL: Source, https://github.com/worldbank/GOSTnets
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: geojson
Requires-Dist: geopandas
Requires-Dist: networkx
Requires-Dist: numpy
Requires-Dist: osmnx >=1.0.1
Requires-Dist: pandas >=0.23.5
Requires-Dist: pyproj >=2.4.2
Requires-Dist: rasterio
Requires-Dist: rtree >=0.9.3
Requires-Dist: scipy
Requires-Dist: shapely
Requires-Dist: boltons
Requires-Dist: geopy
Requires-Dist: pyarrow
Provides-Extra: dev
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: tomli ; extra == 'dev'
Requires-Dist: coverage[toml] ; extra == 'dev'
Requires-Dist: docutils ==0.17.1 ; extra == 'dev'
Requires-Dist: jupyter-book <3,>=2 ; extra == 'dev'
Requires-Dist: sphinxcontrib-apidoc <1,>=0.4.0 ; extra == 'dev'
Requires-Dist: jupyter-cache >=0.6.0 ; extra == 'dev'
Requires-Dist: nbconvert ; extra == 'dev'
Requires-Dist: pooch ; extra == 'dev'
Requires-Dist: pulp ; extra == 'dev'
Provides-Extra: tutorials
Requires-Dist: overturemaps ; extra == 'tutorials'
Requires-Dist: jupyter ; extra == 'tutorials'
Requires-Dist: ipywidgets ; extra == 'tutorials'
Requires-Dist: ipyleaflet ; extra == 'tutorials'
Requires-Dist: ipykernel ; extra == 'tutorials'

# GOSTnets: Build, process, and analyze networks

GOSTNets is a Python library from the World Bank's GOST team that streamlines geospatial network analysis, especially with OpenStreetMap data. It provides a convenience layer on top of networkx and integrates with geopandas, osmnx, and rtree to build, clean, and analyze spatial graphs, and to convert networkx graphs to GeoDataFrames for mapping and analysis. Typical uses include travel-time and accessibility studies (e.g., health facility access), urban and transport network analysis, and infrastructure planning workflows

## Installation

### From PyPI

The first line includes conda install of several libraries; this is to support Windows users for whom gdal and geopandas do not install cleanly through pip.

```shell
conda create --name gostnets geopandas osmnx -c conda-forge
conda activate gostnets
pip install GOSTnets
```

Additionally, there are two extensions you may want to include.

```shell
pip install GOSTnets[tutorials]
```

```shell
pip install GOSTnets[dev]
```

### 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.

## 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
#-------------------------------------------------------------------------#
```

## 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.
