georouting


Namegeorouting JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/wybert/georouting
SummaryGeo routing for Python users
upload_time2023-02-11 18:54:29
maintainer
docs_urlNone
authorXiaokang Fu
requires_python>=3.7
licenseMIT license
keywords georouting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
![georouting](https://raw.githubusercontent.com/wybert/georouting/main/docs/img/georouting.png)




[![image](https://img.shields.io/pypi/v/georouting.svg)](https://pypi.python.org/pypi/georouting)
[![image](https://img.shields.io/conda/vn/conda-forge/georouting.svg)](https://anaconda.org/conda-forge/georouting)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/wybert/georouting/blob/main/docs/usage.ipynb)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
<!-- [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder) -->
<!-- [![Open In Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/giswqs/geemap/blob/master/examples/notebooks/00_geemap_key_features.ipynb) -->
<!-- [![image](https://img.shields.io/conda/vn/conda-forge/geemap.svg)](https://anaconda.org/conda-forge/geemap) -->
<!-- [![image](https://pepy.tech/badge/geemap)](https://pepy.tech/project/geemap) -->
[![image](https://github.com/wybert/georouting/workflows/docs/badge.svg)](https://wybert.github.io/georouting/)
[![image](https://github.com/wybert/georouting/workflows/build/badge.svg)](https://github.com/wybert/georouting/actions?query=workflow%3Abuild)
[![image](https://img.shields.io/badge/YouTube-Channel-red)](https://youtube.com/@xiaokangfu3118)
[![image](https://img.shields.io/twitter/follow/fxk123?style=social)](https://twitter.com/fxk123)
[![image](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
<!-- [![image](https://joss.theoj.org/papers/10.21105/joss.02305/status.svg)](https://joss.theoj.org/papers/10.21105/joss.02305) -->


**Geo routing for Python users**, supporting most of the routing tools, including OSRM, Google Maps, Bing Maps, etc. with a unified API. 

Warning!!! This project is under active development, wait for the release of version 1.0.0 if you want to use it in production. This package is inspired by [geopy](https://geopy.readthedocs.io/en/stable/). Please help to improve this package by submitting issues and pull requests.


-   Free software: MIT license
-   Documentation: [https://wybert.github.io/georouting](https://wybert.github.io/georouting)
    

## Features

- Support most of the routing services, including Google Maps, Bing Maps, OSRM, etc.
- Provide a unified API for routing services
- Support calculating the travel distance matrix between multiple origins and destinations
- Support calculating the travel distance according to OD pairs.
- Easy to visualize the routing results
- Return the travel distance matrix in a Pandas `Dataframe` you like
- Return the routing results in a Geopandas `GeoDataFrame`
- Easy to extend to support more routing services


## Installation

### Using pip


To install georouting, run this command in your terminal:

```bash
pip install georouting
```

or install from GitHub source

```
pip install git+https://github.com/wybert/georouting.git
```


If you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.

### Using conda

This is not yet available on conda-forge,

```
conda install -c conda-forge georouting
```

or use mamba

```
mamba install -c conda-forge georouting
```


## Install from sources

The sources for georouting can be downloaded from the Github repo.

You can clone the public repository:

```
git clone git://github.com/wybert/georouting
```

Then install it with:

```
python setup.py install
```



## Usage

```python

# how to get routing distance matrix from OSRMRouter
import pandas as pd
data = pd.read_csv("https://raw.githubusercontent.com/wybert/georouting/main/docs/data/sample_3.csv",index_col=0)
one_od_pair = data.iloc[2]
data.head()

from georouting.routers import GoogleRouter
# create a router object with the google_key
router = GoogleRouter(google_key,mode="driving")
# get the route between the origin and destination, this will return a Route object
# this will call the Google Maps API
route = router.get_route([one_od_pair["ZIP_lat"],one_od_pair["ZIP_lon"]],
                           [one_od_pair["AHA_ID_lat"],one_od_pair["AHA_ID_lon"]])
# Now you can get the distance and duration of the route in meters and seconds
print("Distance: {} meters".format(route.get_distance()))
print("Duration: {} seconds".format(route.get_duration()))

df= route.get_route_geopandas()
df.head()

df.explore(column="speed (m/s)",style_kwds={"weight":11,"opacity":0.8})

```


## TODO
- [x] Google Maps
- [x] Bing Maps
- [x] OSRM Routing
- [x] add more documentation for google router
- [x] add more documentation for bing router
- [x] add more documentation for osrm router
- [x] built and host documentation
- [x] Fix the update in Pypi
- [x] add get_route_distance_batch API
- [x] add visualization for the route, better with o and d markers
- [x] Limit the number of origins and destinations in the distance matrix
- [x] avoid repeat documentation
- [x] add ESRI router
- [x] Add test 
- [x] Add more examples
- [x] Add how to contribute
- [x] change the show case use OSRM
- [x] add OSMnx router
- [ ] static plot for the route
- [x] add one API for all routers
- [ ] Add how to cite


## Credits

This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) and the [giswqs/pypackage](https://github.com/giswqs/pypackage) project template.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wybert/georouting",
    "name": "georouting",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "georouting",
    "author": "Xiaokang Fu",
    "author_email": "fxk123@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/68/befd0e12eba322291c6bfeb530f641f945d51334cc608286d8eb610571cc/georouting-0.0.8.tar.gz",
    "platform": null,
    "description": "\n![georouting](https://raw.githubusercontent.com/wybert/georouting/main/docs/img/georouting.png)\n\n\n\n\n[![image](https://img.shields.io/pypi/v/georouting.svg)](https://pypi.python.org/pypi/georouting)\n[![image](https://img.shields.io/conda/vn/conda-forge/georouting.svg)](https://anaconda.org/conda-forge/georouting)\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/wybert/georouting/blob/main/docs/usage.ipynb)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n<!-- [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder) -->\n<!-- [![Open In Studio Lab](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/giswqs/geemap/blob/master/examples/notebooks/00_geemap_key_features.ipynb) -->\n<!-- [![image](https://img.shields.io/conda/vn/conda-forge/geemap.svg)](https://anaconda.org/conda-forge/geemap) -->\n<!-- [![image](https://pepy.tech/badge/geemap)](https://pepy.tech/project/geemap) -->\n[![image](https://github.com/wybert/georouting/workflows/docs/badge.svg)](https://wybert.github.io/georouting/)\n[![image](https://github.com/wybert/georouting/workflows/build/badge.svg)](https://github.com/wybert/georouting/actions?query=workflow%3Abuild)\n[![image](https://img.shields.io/badge/YouTube-Channel-red)](https://youtube.com/@xiaokangfu3118)\n[![image](https://img.shields.io/twitter/follow/fxk123?style=social)](https://twitter.com/fxk123)\n[![image](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n<!-- [![image](https://joss.theoj.org/papers/10.21105/joss.02305/status.svg)](https://joss.theoj.org/papers/10.21105/joss.02305) -->\n\n\n**Geo routing for Python users**, supporting most of the routing tools, including OSRM, Google Maps, Bing Maps, etc. with a unified API. \n\nWarning!!! This project is under active development, wait for the release of version 1.0.0 if you want to use it in production. This package is inspired by [geopy](https://geopy.readthedocs.io/en/stable/). Please help to improve this package by submitting issues and pull requests.\n\n\n-   Free software: MIT license\n-   Documentation: [https://wybert.github.io/georouting](https://wybert.github.io/georouting)\n    \n\n## Features\n\n- Support most of the routing services, including Google Maps, Bing Maps, OSRM, etc.\n- Provide a unified API for routing services\n- Support calculating the travel distance matrix between multiple origins and destinations\n- Support calculating the travel distance according to OD pairs.\n- Easy to visualize the routing results\n- Return the travel distance matrix in a Pandas `Dataframe` you like\n- Return the routing results in a Geopandas `GeoDataFrame`\n- Easy to extend to support more routing services\n\n\n## Installation\n\n### Using pip\n\n\nTo install georouting, run this command in your terminal:\n\n```bash\npip install georouting\n```\n\nor install from GitHub source\n\n```\npip install git+https://github.com/wybert/georouting.git\n```\n\n\nIf you don't have [pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process.\n\n### Using conda\n\nThis is not yet available on conda-forge,\n\n```\nconda install -c conda-forge georouting\n```\n\nor use mamba\n\n```\nmamba install -c conda-forge georouting\n```\n\n\n## Install from sources\n\nThe sources for georouting can be downloaded from the Github repo.\n\nYou can clone the public repository:\n\n```\ngit clone git://github.com/wybert/georouting\n```\n\nThen install it with:\n\n```\npython setup.py install\n```\n\n\n\n## Usage\n\n```python\n\n# how to get routing distance matrix from OSRMRouter\nimport pandas as pd\ndata = pd.read_csv(\"https://raw.githubusercontent.com/wybert/georouting/main/docs/data/sample_3.csv\",index_col=0)\none_od_pair = data.iloc[2]\ndata.head()\n\nfrom georouting.routers import GoogleRouter\n# create a router object with the google_key\nrouter = GoogleRouter(google_key,mode=\"driving\")\n# get the route between the origin and destination, this will return a Route object\n# this will call the Google Maps API\nroute = router.get_route([one_od_pair[\"ZIP_lat\"],one_od_pair[\"ZIP_lon\"]],\n                           [one_od_pair[\"AHA_ID_lat\"],one_od_pair[\"AHA_ID_lon\"]])\n# Now you can get the distance and duration of the route in meters and seconds\nprint(\"Distance: {} meters\".format(route.get_distance()))\nprint(\"Duration: {} seconds\".format(route.get_duration()))\n\ndf= route.get_route_geopandas()\ndf.head()\n\ndf.explore(column=\"speed (m/s)\",style_kwds={\"weight\":11,\"opacity\":0.8})\n\n```\n\n\n## TODO\n- [x] Google Maps\n- [x] Bing Maps\n- [x] OSRM Routing\n- [x] add more documentation for google router\n- [x] add more documentation for bing router\n- [x] add more documentation for osrm router\n- [x] built and host documentation\n- [x] Fix the update in Pypi\n- [x] add get_route_distance_batch API\n- [x] add visualization for the route, better with o and d markers\n- [x] Limit the number of origins and destinations in the distance matrix\n- [x] avoid repeat documentation\n- [x] add ESRI router\n- [x] Add test \n- [x] Add more examples\n- [x] Add how to contribute\n- [x] change the show case use OSRM\n- [x] add OSMnx router\n- [ ] static plot for the route\n- [x] add one API for all routers\n- [ ] Add how to cite\n\n\n## Credits\n\nThis package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) and the [giswqs/pypackage](https://github.com/giswqs/pypackage) project template.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Geo routing for Python users",
    "version": "0.0.8",
    "split_keywords": [
        "georouting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9badb1cf36245cfca3b4b4d2e01bee739fcf93adf3e174b21c140b328b7ae63b",
                "md5": "2e09218bc538826690da78580ab54dd1",
                "sha256": "d0abf4122bfe61dc71a7166b1f2ba1513c9dd7e824278a355e21caf1bc4e2c05"
            },
            "downloads": -1,
            "filename": "georouting-0.0.8-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2e09218bc538826690da78580ab54dd1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.7",
            "size": 25454,
            "upload_time": "2023-02-11T18:54:28",
            "upload_time_iso_8601": "2023-02-11T18:54:28.250661Z",
            "url": "https://files.pythonhosted.org/packages/9b/ad/b1cf36245cfca3b4b4d2e01bee739fcf93adf3e174b21c140b328b7ae63b/georouting-0.0.8-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d668befd0e12eba322291c6bfeb530f641f945d51334cc608286d8eb610571cc",
                "md5": "f1468d9fd6837eaa908571322a3e5e94",
                "sha256": "b6807dcfa55a1667ed360225d2bffd137f91e8fb5ed29f4b8c9e7e5389d7cb4f"
            },
            "downloads": -1,
            "filename": "georouting-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "f1468d9fd6837eaa908571322a3e5e94",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19989,
            "upload_time": "2023-02-11T18:54:29",
            "upload_time_iso_8601": "2023-02-11T18:54:29.473514Z",
            "url": "https://files.pythonhosted.org/packages/d6/68/befd0e12eba322291c6bfeb530f641f945d51334cc608286d8eb610571cc/georouting-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-11 18:54:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "wybert",
    "github_project": "georouting",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "georouting"
}
        
Elapsed time: 0.09446s