Skip to main content

Network wrapper to simplify network analysis using geospatial data

Project description

GOSTnets: Build, process, and analyze networks

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:

    git clone https://github.com/worldbank/GOSTnets.git
    cd GOSTnets
    
  2. Create a virtual environment (optional but recommended):

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install the package in editable mode with dependencies:

    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 - which not required to use 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)

pip install GOSTnets[osm]

Optimization Support (Needed to run functions from optimization.py)

pip install GOSTnets[opt]

Development Support

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:

import GOSTnets as gn
gn.edge_gdf_from_graph?

returns:

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. This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gostnets-1.2.0.tar.gz (43.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gostnets-1.2.0-py3-none-any.whl (68.1 kB view details)

Uploaded Python 3

File details

Details for the file gostnets-1.2.0.tar.gz.

File metadata

  • Download URL: gostnets-1.2.0.tar.gz
  • Upload date:
  • Size: 43.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gostnets-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7e19d558ba9820f4ab7c505ac9d57f5bcffec2f4d5c49d6f97c7dc11c05ced97
MD5 b50f11dd4690e8da2f6162b04f7d518b
BLAKE2b-256 18acff5cdf470b7e36d9613558a964c5016d5b5aa23103c55e2a68954f836221

See more details on using hashes here.

Provenance

The following attestation bundles were made for gostnets-1.2.0.tar.gz:

Publisher: release.yml on worldbank/GOSTnets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gostnets-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: gostnets-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 68.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gostnets-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14b251bd4007a87155a6eddde952f7132fd32104b8eec8a9d4ad5e1187be34a2
MD5 4c24e40d21a781c7a4160c998e283a53
BLAKE2b-256 5cfe8446287519af266c222f3c77d8b40bc09682007f0e5727716d99ac13c07b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gostnets-1.2.0-py3-none-any.whl:

Publisher: release.yml on worldbank/GOSTnets

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page