{"id":17204461,"url":"https://github.com/mthh/pyq-osrm","last_synced_at":"2025-07-01T00:05:05.094Z","repository":{"id":95037601,"uuid":"34807760","full_name":"mthh/pyq-osrm","owner":"mthh","description":"Simple python script to query OSRM in order to build a distance matrix between a set of locations and get associated routes geometries and other infos (output as .shp)","archived":false,"fork":false,"pushed_at":"2015-12-17T09:21:05.000Z","size":26,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T09:49:48.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mthh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-29T17:26:15.000Z","updated_at":"2024-01-11T21:07:16.000Z","dependencies_parsed_at":"2023-05-30T00:30:49.282Z","dependency_job_id":null,"html_url":"https://github.com/mthh/pyq-osrm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mthh/pyq-osrm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mthh%2Fpyq-osrm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mthh%2Fpyq-osrm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mthh%2Fpyq-osrm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mthh%2Fpyq-osrm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mthh","download_url":"https://codeload.github.com/mthh/pyq-osrm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mthh%2Fpyq-osrm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261243237,"owners_count":23129600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T02:22:02.011Z","updated_at":"2025-07-01T00:05:05.062Z","avatar_url":"https://github.com/mthh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyq-osrm\n\nA simple python3 script to query a local OSRM server API in order to get a distance/time matrix between a set of points and export all associated routes geometries in a shapefile.\n\nThis script use the great routing engine [OSRM](https://github.com/Project-OSRM/), so it's supposed that you have an osrm server running locally (on http://localhost:5000/). It also requires that you have a python 3 interpreter installed/associated with your .py files.\n\nIt's a simple try to replicate the \"http://localhost:5000/table?...\" request (it only provides time between locations) by many \"http://localhost:5000/viaroute?...\" requests in order to obtain the geometry of each fastest route calculted.\n\n## Requirement\nSome python modules are needed :\n* Polyline\n* Gdal\n* aiohttp (only for the *asynchronous* mode)\n\n## Installation\n\u003e $ git clone https://github.com/mthh/pyq-osrm.git  \n\u003e $ cd pyq-osrm/  \n\u003e $ chmod +x pyq-osrm.py  \n\n## Usage \nThe input file must be a point shapefile (with an unique id in the first field) or a csv file (first line as headers) with comma separator and 3 fields (x, y and an id, whatever the order) like :\n\u003e    lat,long,name_or_id_of_the_place\n\n(see the example.csv file)\n\nThe output file is a shapefile containing a line for each route (i.e. the fastest route between a couple of source/destination, calculated by OSRM) and following fields : the distance of road (in meters), the time on the road (in seconds), the euclidian distance (in meters), the name of the source and the name of the target.\n\nThe script can be called like this :\n\n\u003e $ ./pyq-osrm.py input_file.shp\n\nor\n\u003e $ ./pyq-osrm.py input_file.csv -o output_file.shp\n\nThis script also allow you to make only a '1-to-many' calcul. The first location in the .csv file will be the only source point and others will be all the destinations. Just add the `-m` parameter at the end :\n\u003e\t$ ./pyq-osrm.py input_file.csv -m\n\nIt is also possible to do the opposite calculation (many-to-one) by using the parameter `-t` :\n\u003e $ ./pyq-osrm.py input_file.csv -t\n\nThe operation can be done between differents origins and destinations by using the parameter `-d` :\n\u003e $ ./pyq-osrm.py origins.csv -d destinations.csv -o output_file.shp\n\nIn addition it is possible to use *coroutines* to fetch the result with the parameter `-a` (or `--async`) followed by the number of maximum concurrent requests :\n\u003e $ ./pyq-osrm.py input_file.csv -o output_file.shp -a 150\n\n\nFeel free to make any comment, this script is in its very early stage of development (many errors/exeptions are probably not yet handled).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmthh%2Fpyq-osrm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmthh%2Fpyq-osrm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmthh%2Fpyq-osrm/lists"}