Simple OSRM routing and Folium map drawing toolkit
Project description
cartons
A small Python toolkit for routing and map visualization.
cartons calculates routes using OSRM (via routingpy) and draws them on an interactive Leaflet map using folium.
With just a few lines of code you can compute a route between two coordinates and render it as an HTML map.
It is designed to be simple, lightweight, and easy to integrate into scripts or small projects.
Installation
Installation from PyPI availiable since 11.03.2026 Install from PyPI:
pip install cartons
Or install locally from the repository:
pip install -e .
Dependencies:
- routingpy
- folium
Quick Example
import cartons
m = cartons.draw(
"https://router.project-osrm.org",
8.5417, 47.3769,
8.55, 47.38
)
m.save("route.html")
This generates an interactive HTML map showing the calculated route.
How It Works
The package has two main modules:
cartons/
├ routing.py
├ display.py
└ __init__.py
routing.py
Handles communication with the OSRM routing engine using routingpy.
It sends coordinates to the routing server and returns the full route response.
display.py
Extracts route geometry and draws the route using folium.
Coordinates returned by OSRM are converted from:
[lon, lat]
to
[lat, lon]
because Folium expects latitude first.
Public OSRM Server
The examples use the public demo server:
https://router.project-osrm.org
This server is suitable for testing and small scripts.
For production usage, running your own OSRM server is recommended.
Project Goals
cartons aims to provide:
- simple routing interface
- quick map visualization
- minimal dependencies
- easy integration into Python scripts
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cartons-1.0.1.tar.gz.
File metadata
- Download URL: cartons-1.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe5d961a021c513ca69f2d99ca0582d5ab20c3035a59b5f6a8e5ee07f6cfb785
|
|
| MD5 |
e789ab9f0ad007ac6dd48e7657a69f0f
|
|
| BLAKE2b-256 |
a397ac17d926464873a8d36fda77b27e96c166555a82c66fbd16c0fccec95201
|
Provenance
The following attestation bundles were made for cartons-1.0.1.tar.gz:
Publisher:
python-publish.yml on AndPan3/cartons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cartons-1.0.1.tar.gz -
Subject digest:
fe5d961a021c513ca69f2d99ca0582d5ab20c3035a59b5f6a8e5ee07f6cfb785 - Sigstore transparency entry: 1085580896
- Sigstore integration time:
-
Permalink:
AndPan3/cartons@616bf5a6de5c2ee9c86337eedf09e84ab6dc2787 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/AndPan3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@616bf5a6de5c2ee9c86337eedf09e84ab6dc2787 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cartons-1.0.1-py3-none-any.whl.
File metadata
- Download URL: cartons-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9132599ab90dbb9004517496f431b04439adec92fda12d1d50842eee1655e41
|
|
| MD5 |
67b5cea9ff2d94a763653f4560587025
|
|
| BLAKE2b-256 |
f7e27d2f98ac86c7c40a40dd6f4693fa6afd78da3c24e9e1c8e2204f0cdc5187
|
Provenance
The following attestation bundles were made for cartons-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on AndPan3/cartons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cartons-1.0.1-py3-none-any.whl -
Subject digest:
c9132599ab90dbb9004517496f431b04439adec92fda12d1d50842eee1655e41 - Sigstore transparency entry: 1085580936
- Sigstore integration time:
-
Permalink:
AndPan3/cartons@616bf5a6de5c2ee9c86337eedf09e84ab6dc2787 -
Branch / Tag:
refs/tags/1.0.1 - Owner: https://github.com/AndPan3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@616bf5a6de5c2ee9c86337eedf09e84ab6dc2787 -
Trigger Event:
release
-
Statement type: