cartons 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cartons-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andrej Bajusic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cartons-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: cartons
3
+ Version: 1.0.0
4
+ Summary: Simple OSRM routing and Folium map drawing toolkit
5
+ Requires-Python: >=3.7
6
+ License-File: LICENSE
7
+ Requires-Dist: routingpy
8
+ Requires-Dist: folium
9
+ Dynamic: license-file
@@ -0,0 +1,116 @@
1
+ # cartons
2
+
3
+ A small Python toolkit for routing and map visualization.
4
+
5
+ `cartons` calculates routes using **OSRM** (via `routingpy`) and draws them on an interactive **Leaflet map** using `folium`.
6
+
7
+ With just a few lines of code you can compute a route between two coordinates and render it as an HTML map.
8
+
9
+ It is designed to be simple, lightweight, and easy to integrate into scripts or small projects.
10
+
11
+ ---
12
+
13
+ # Installation
14
+ -not yet-
15
+ Install from PyPI:
16
+
17
+ ```bash
18
+ pip install cartons
19
+ ```
20
+
21
+ Or install locally from the repository:
22
+
23
+ ```bash
24
+ pip install -e .
25
+ ```
26
+
27
+ Dependencies:
28
+
29
+ - routingpy
30
+ - folium
31
+
32
+ ---
33
+
34
+ # Quick Example
35
+
36
+ ```python
37
+ import cartons
38
+
39
+ m = cartons.draw(
40
+ "https://router.project-osrm.org",
41
+ 8.5417, 47.3769,
42
+ 8.55, 47.38
43
+ )
44
+
45
+ m.save("route.html")
46
+ ```
47
+
48
+ This generates an **interactive HTML map** showing the calculated route.
49
+
50
+ ---
51
+
52
+ # How It Works
53
+
54
+ The package has two main modules:
55
+
56
+ ```
57
+ cartons/
58
+ ├ routing.py
59
+ ├ display.py
60
+ └ __init__.py
61
+ ```
62
+
63
+ ### routing.py
64
+
65
+ Handles communication with the OSRM routing engine using `routingpy`.
66
+
67
+ It sends coordinates to the routing server and returns the full route response.
68
+
69
+ ### display.py
70
+
71
+ Extracts route geometry and draws the route using `folium`.
72
+
73
+ Coordinates returned by OSRM are converted from:
74
+
75
+ ```
76
+ [lon, lat]
77
+ ```
78
+
79
+ to
80
+
81
+ ```
82
+ [lat, lon]
83
+ ```
84
+
85
+ because Folium expects latitude first.
86
+
87
+ ---
88
+
89
+ # Public OSRM Server
90
+
91
+ The examples use the public demo server:
92
+
93
+ ```
94
+ https://router.project-osrm.org
95
+ ```
96
+
97
+ This server is suitable for testing and small scripts.
98
+
99
+ For production usage, running your own OSRM server is recommended.
100
+
101
+ ---
102
+
103
+ # Project Goals
104
+
105
+ `cartons` aims to provide:
106
+
107
+ - simple routing interface
108
+ - quick map visualization
109
+ - minimal dependencies
110
+ - easy integration into Python scripts
111
+
112
+ ---
113
+
114
+ # License
115
+
116
+ MIT License
@@ -0,0 +1,2 @@
1
+ from .routing import get_route
2
+ from .display import draw
@@ -0,0 +1,15 @@
1
+ from .routing import get_route
2
+ import folium
3
+ def draw(base_url, lon1, lat1, lon2, lat2, col, weight):
4
+
5
+ route = get_route(base_url, lon1, lat1, lon2, lat2)
6
+
7
+ routecoords = route.routes[0].geometry["coordinates"]
8
+ foliumcoords = [[lat, lon] for lon, lat in routecoords]
9
+ m = folium.Map(
10
+ location=(lat1, lon1),
11
+ control_scale=True,
12
+ )
13
+ folium.Polyline(
14
+ foliumcoords, color=col, weight=weight).add_to(m)
15
+ return m
@@ -0,0 +1,11 @@
1
+ from routingpy import OSRM
2
+
3
+ def get_route(base_url, lon1, lat1, lon2,lat2):
4
+ router = OSRM(base_url=base_url)
5
+ coords = [
6
+ (lon1, lat1),
7
+ (lon2, lat2)]
8
+ route = router.directions(
9
+ locations = coords
10
+ )
11
+ return route
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: cartons
3
+ Version: 1.0.0
4
+ Summary: Simple OSRM routing and Folium map drawing toolkit
5
+ Requires-Python: >=3.7
6
+ License-File: LICENSE
7
+ Requires-Dist: routingpy
8
+ Requires-Dist: folium
9
+ Dynamic: license-file
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ cartons/__init__.py
5
+ cartons/display.py
6
+ cartons/routing.py
7
+ cartons.egg-info/PKG-INFO
8
+ cartons.egg-info/SOURCES.txt
9
+ cartons.egg-info/dependency_links.txt
10
+ cartons.egg-info/requires.txt
11
+ cartons.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ routingpy
2
+ folium
@@ -0,0 +1 @@
1
+ cartons
@@ -0,0 +1,14 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cartons"
7
+ version = "1.00.000"
8
+ description = "Simple OSRM routing and Folium map drawing toolkit"
9
+ requires-python = ">=3.7"
10
+
11
+ dependencies = [
12
+ "routingpy",
13
+ "folium"
14
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+