Name | trekpy JSON |
Version |
0.0.6
JSON |
| download |
home_page | https://github.com/teddyoweh/Trek |
Summary | Using graph theory algorithms and simulations, to optimaize paths and travel times between nodes on a geospatial map |
upload_time | 2023-03-22 08:36:06 |
maintainer | |
docs_url | None |
author | Teddy Oweh |
requires_python | |
license | MIT |
keywords |
trek
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Trek - Optimal Path Simulaion on Geospatial Map
Trek is a Python package that provides functionality for optimizing paths and travel times between nodes on a geospatial map, using graph theory algorithms and simulations. This package can be used to identify the best possible route between two or more points, based on factors such as distance, speed, and other constraints.
### Installation
To install Trek, you can use pip:
```sh
$ python3 pip install trekpy
```
### Usage
To use Trek, you must first create an instance of the Trek class, which takes a JSON file as input containing the geospatial map data. Once you have initialized a Trek object, you can use its methods to visualize the graph representation of the map, and to find the optimal path between two points.
### Data File
Trek uses a JSON file to store the geospatial map data. The file is stored in the same directory as the Python script that uses Trek. The file name is the same as the name of the Python script.
The Location/Node Name is the keys, a hash map of latitude and longitude points are the values
- map.json (earth)
```json
{
"Engineering Buiding":{
"latitude":32.214256505009985,
"longitude": -98.21779723918512
},
"Library":{
"latitude":32.215730969726785,
"longitude": -98.21730569278304
},
"Nursing Building":{
"latitude":32.21664588196621,
"longitude": -98.22043371534166
},
"Centennial":{
"latitude":32.217553223855305,
"longitude": -98.2217742964382
},
"Rec":{
"latitude":32.21630562642345,
"longitude": -98.2224535241938
},
"Science Building":{
"latitude": 32.216883861659866,
"longitude": -98.21972368519181
},
}
```
-map.json (canvas)
```json
{
"A": {
"x": -0.019863067642025122,
"y": -0.943951654391012
},
"B": {
"x": 0.8559401394488363,
"y": -0.01622570094196981
},
"C": {
"x": 0.1397386472898502,
"y": 0.9999999999999999
},
"D": {
"x": -0.9758157190966613,
"y": -0.03982264466701821
}
}
```
### QuickStart
- env varies depends on your map data - [earth or canvas]
```py
from trekpy.Trek import Trek
# Initialize a Trek object
t = Trek(filename='map.json',env='earth') # or t = Trek(filename='map.json',env='canvas')
```
```py
# Get Locations
t.locations # list[str]
#Estimate time to cover a distance from start to end over a time
t.estimate_time(start='A',end='B',speed=3.1) # speed is default 3.1 - average walking speed miles per hour - returns in minutes
# Visualize the graph representation of the map
t.graph() # View Data as a Map Visually
# Distance between to points on the map
t.distance('A', 'B')
# Plot the map on a line graph
t.plot_line_graph()
# Plot the map on a dot graph
t.plot_dot_graph()
# Manually Map out on environment
t.plot_web(port=9949)
# Find the optimal path between two points
planned = ['A', 'B', 'C', 'D', 'E'] # Places you plan to stop or visit, include start and end
start = 'A'
end = 'E'
speed = 3.1
best_sol = t.find_optimal_path(planned=planned, start=start, end=end, speed=speed)
# Visualize the optimal path on the map
t.visualize_optimal_path(best_sol['path'], best_sol['times'])
```
## Visualization
### Graph - Mapping out Data
![](./images/2.png)
### Visualizing Optimal Path
![](./images/1.png)
### Dot Graph
![](./images/3.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/teddyoweh/Trek",
"name": "trekpy",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Trek",
"author": "Teddy Oweh",
"author_email": "teddyoweh@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4c/0b/185aa02f0efbf3d392469d847d867ea801a3df82846f3f196f8d9c0add6b/trekpy-0.0.6.tar.gz",
"platform": null,
"description": "# Trek - Optimal Path Simulaion on Geospatial Map\n\nTrek is a Python package that provides functionality for optimizing paths and travel times between nodes on a geospatial map, using graph theory algorithms and simulations. This package can be used to identify the best possible route between two or more points, based on factors such as distance, speed, and other constraints.\n\n\n### Installation\nTo install Trek, you can use pip:\n```sh\n$ python3 pip install trekpy\n```\n\n### Usage\nTo use Trek, you must first create an instance of the Trek class, which takes a JSON file as input containing the geospatial map data. Once you have initialized a Trek object, you can use its methods to visualize the graph representation of the map, and to find the optimal path between two points.\n \n### Data File\nTrek uses a JSON file to store the geospatial map data. The file is stored in the same directory as the Python script that uses Trek. The file name is the same as the name of the Python script.\n\nThe Location/Node Name is the keys, a hash map of latitude and longitude points are the values\n\n- map.json (earth)\n```json\n{\n \"Engineering Buiding\":{\n \"latitude\":32.214256505009985,\n \"longitude\": -98.21779723918512\n },\n \"Library\":{\n \"latitude\":32.215730969726785,\n \"longitude\": -98.21730569278304\n },\n \"Nursing Building\":{\n \"latitude\":32.21664588196621,\n \"longitude\": -98.22043371534166\n },\n \"Centennial\":{\n \"latitude\":32.217553223855305,\n \"longitude\": -98.2217742964382\n },\n \"Rec\":{\n \"latitude\":32.21630562642345,\n \"longitude\": -98.2224535241938\n },\n \"Science Building\":{\n \"latitude\": 32.216883861659866, \n \"longitude\": -98.21972368519181\n },\n}\n```\n-map.json (canvas)\n```json\n{\n \"A\": {\n \"x\": -0.019863067642025122,\n \"y\": -0.943951654391012\n }, \n \"B\": {\n \"x\": 0.8559401394488363,\n \"y\": -0.01622570094196981\n }, \n \"C\": {\n \"x\": 0.1397386472898502, \n \"y\": 0.9999999999999999\n }, \n \"D\": {\n \"x\": -0.9758157190966613,\n \"y\": -0.03982264466701821\n }\n}\n```\n### QuickStart\n- env varies depends on your map data - [earth or canvas]\n```py\nfrom trekpy.Trek import Trek \n\n# Initialize a Trek object\nt = Trek(filename='map.json',env='earth') # or t = Trek(filename='map.json',env='canvas')\n```\n```py\n# Get Locations\nt.locations # list[str]\n\n#Estimate time to cover a distance from start to end over a time\nt.estimate_time(start='A',end='B',speed=3.1) # speed is default 3.1 - average walking speed miles per hour - returns in minutes\n# Visualize the graph representation of the map\nt.graph() # View Data as a Map Visually\n\n# Distance between to points on the map\nt.distance('A', 'B')\n\n# Plot the map on a line graph\nt.plot_line_graph()\n\n# Plot the map on a dot graph \nt.plot_dot_graph()\n\n# Manually Map out on environment\nt.plot_web(port=9949)\n# Find the optimal path between two points\nplanned = ['A', 'B', 'C', 'D', 'E'] # Places you plan to stop or visit, include start and end\nstart = 'A'\nend = 'E'\nspeed = 3.1\nbest_sol = t.find_optimal_path(planned=planned, start=start, end=end, speed=speed)\n\n# Visualize the optimal path on the map\nt.visualize_optimal_path(best_sol['path'], best_sol['times'])\n\n\n\n```\n\n## Visualization\n\n### Graph - Mapping out Data\n![](./images/2.png)\n\n### Visualizing Optimal Path\n![](./images/1.png)\n\n### Dot Graph\n![](./images/3.png)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Using graph theory algorithms and simulations, to optimaize paths and travel times between nodes on a geospatial map",
"version": "0.0.6",
"split_keywords": [
"trek"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c0b185aa02f0efbf3d392469d847d867ea801a3df82846f3f196f8d9c0add6b",
"md5": "a84ae3c0a3e06a0b0840e5185c6dadcd",
"sha256": "fb93992610cbb5d05c240c056e63c21056254372d6a251946413a31aea8a9161"
},
"downloads": -1,
"filename": "trekpy-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "a84ae3c0a3e06a0b0840e5185c6dadcd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8304,
"upload_time": "2023-03-22T08:36:06",
"upload_time_iso_8601": "2023-03-22T08:36:06.340210Z",
"url": "https://files.pythonhosted.org/packages/4c/0b/185aa02f0efbf3d392469d847d867ea801a3df82846f3f196f8d9c0add6b/trekpy-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-22 08:36:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "teddyoweh",
"github_project": "Trek",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "trekpy"
}