OSRM Routes Scraper
parseforge/osrm-routing-scraper
BusinessAutomationOther
Scrapes OSRM driving, cycling, and walking routes from coordinates. Returns distance, duration, turn-by-turn steps, and geometry for each route.
- Total users
- 4
- Monthly active
- 0
- Total runs
- 120
- Bookmarked
- 0
- Rating
- Not rated yet
- Last modified
- 12 days ago
Overview
OSRM Routes Scraper
Scrape OSRM driving, cycling, and walking routes from any coordinates, up to a million per run. Every route comes with distance, duration, turn-by-turn steps, and geometry. No API key or proxy. Export to CSV, JSON, Excel, or XML.
OSRM's public demo server is rate-limited and returns only one route at a time. This Actor sends your origin-destination pairs directly to the free OSRM routing engine, with optional via-points, and returns each route in one flat row. It handles driving, cycling, and foot profiles, and can return alternative routes and per-segment annotations.
| Who uses it | What they scrape OSRM for |
|---|---|
| Logistics planners | Compute driving distances and durations between depots and delivery points |
| Urban mobility researchers | Compare cycling and walking route options across a city |
| Field service managers | Generate turn-by-turn directions for technicians visiting multiple sites |
| GIS analysts | Extract route geometry for mapping and spatial analysis |
| Travel app developers | Populate route previews with distance, duration, and polyline data |
What it does
This Actor collects OSRM routes for the coordinates you provide, and returns each route as a flat row with distance, duration, steps, and geometry.
- π Driving, cycling, or foot: choose the travel profile that matches your use case.
- π Alternative routes: request up to 3 alternatives per origin-destination pair.
- π§ Turn-by-turn steps: include street names, maneuvers, and distances for each leg.
- π Geometry detail: full, simplified, or no polyline, depending on your mapping needs.
- π Per-segment annotations: node IDs, durations, distances, and speeds for advanced analysis.
- π§© Via-points: add intermediate stops as alternating lat/lon pairs.
Results export to CSV, JSON, Excel, or XML, or straight from the API.
What you can do with OSRM data
π Plan delivery routes.
A logistics planner sends a list of depot-to-customer coordinates and uses the returned distances and durations to assign drivers and estimate arrival times.
π² Compare bike and walk options.
An urban mobility researcher runs the same origin-destination pairs with cycling and foot profiles to see how infrastructure affects travel time.
π§ Generate turn-by-turn directions.
A field service manager includes steps for each route and shares the maneuver list with technicians heading to remote sites.
πΊοΈ Extract route geometry for maps.
A GIS analyst requests full geometry and loads the polylines into a web map to visualize corridor options.
π± Populate route previews.
A travel app developer runs a batch of popular city pairs and stores distance, duration, and simplified geometry for instant display.
Why choose this scraper
| What you get | |
|---|---|
| No API key | Uses the free OSRM public routing engine, no registration or proxy needed |
| Batch routes | Send up to a million route requests in a single run |
| Multiple profiles | Driving, cycling, and foot routing from the same input |
| Rich output | Distance, duration, steps, geometry, and optional annotations per route |
| Flexible geometry | Full, simplified, or no polyline to match your mapping or storage needs |
How it compares
This Actor focuses on batch route computation with rich per-route output, while the competitor below also offers distance matrix and nearest-road lookup.
| Feature | ParseForge | OSRM Route Planner Scraper |
|---|---|---|
| Batch route requests | Yes, up to 1,000,000 routes per run | Not listed |
| Turn-by-turn steps | Yes, optional per route | Not listed |
| Alternative routes | Yes, up to 3 per pair | Not listed |
| Per-segment annotations | Yes, optional | Not listed |
| Geometry detail control | Full, simplified, or none | Not listed |
| Distance matrix | Not listed | Yes |
| Nearest-road lookup | Not listed | Yes |
Configure the run
Drive the Actor from a JSON array of route requests, each with start and end coordinates and optional via-points, and set the travel profile, alternatives, steps, annotations, and geometry detail before the run. The Input tab lists every parameter.
A first run with the defaults:
{
"routes": [
{
"startLat": 37.7749,
"startLon": -122.4194,
"endLat": 34.0522,
"endLon": -118.2437
},
{
"startLat": 51.5074,
"startLon": -0.1278,
"endLat": 48.8566,
"endLon": 2.3522
}
],
"maxItems": 10
}
A larger pull:
{
"routes": [
{
"startLat": 37.7749,
"startLon": -122.4194,
"endLat": 34.0522,
"endLon": -118.2437
},
{
"startLat": 51.5074,
"startLon": -0.1278,
"endLat": 48.8566,
"endLon": 2.3522
}
],
"maxItems": 200
}
Pricing
Pay-per-result: $0.038 per result collected. You pay only for the results written to your dataset.
| Results collected | Approximate cost |
|---|---|
| 100 results | $3.80 |
| 1,000 results | $38.00 |
| 10,000 results | $380.00 |
New Apify accounts start with $5 in free credit.
Free users
Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.
Run it
- Create a free Apify account with $5 in credit.
- Open the OSRM Routes Scraper.
- Set your inputs and any filters, then click Start.
- Export the results as CSV, Excel, JSON, or XML from the Dataset tab.
Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.
Use with AI agents (MCP)
Give an AI agent live access to OSRM through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/osrm-routing-scraper"
Then prompt it in plain language to run the scraper and read back the results.
Troubleshooting
Why am I getting no results?
Check that your routes input is a valid JSON array and that each item has startLat, startLon, endLat, and endLon. Also verify that maxItems is at least 1 and that the coordinates are within the OSRM demo server coverage area.
Why are some routes missing alternative routes?
OSRM returns alternative routes only when they exist and are sufficiently different. Try simplifying the route or removing via-points, or check the OSRM server's alternative route settings.
Why is the geometry empty?
If overview is set to 'false', the Actor omits geometry entirely. Set it to 'full' or 'simplified' to include a polyline.
Why do I get a rate limit error?
The public OSRM demo server has rate limits. Reduce the number of routes per run, add a delay between requests, or use your own OSRM instance for higher throughput.
Why are my via-points not working?
Via-points must be provided as alternating latitude and longitude pairs after the start and end coordinates. Ensure the array length is even and that each pair is a valid number.
FAQ
| Question | Answer |
|---|---|
| What is OSRM? | OSRM is the Open Source Routing Machine, a free routing engine based on OpenStreetMap data. It returns driving, cycling, and walking routes with distance, duration, and geometry. |
| Do I need an API key? | No. This Actor uses the public OSRM demo server, which does not require authentication or a proxy. |
| How many routes can I scrape in one run? | You can set maxItems up to 1,000,000 routes per run. The Actor processes each route request in your input array. |
| Can I add intermediate stops? | Yes. Each route request accepts optional via-points as alternating latitude and longitude pairs after the start and end coordinates. |
| What travel profiles are supported? | Driving (car), cycling (bike), and foot (walking). You choose one profile per run, and it applies to all routes in that run. |
| What is the difference between full and simplified geometry? | Full returns every coordinate along the route. Simplified returns a smoothed path with fewer points. You can also set geometry to false to omit it entirely. |
| Can I get alternative routes? | Yes. Set alternatives to true to request up to 3 alternative routes per origin-destination pair, where available. |
| What are per-segment annotations? | When annotations is enabled, the Actor returns node IDs, per-segment durations, distances, and speeds for each route leg. This is useful for advanced analysis. |
| What output formats are supported? | You can export the results to CSV, JSON, Excel, or XML from the Apify dataset. |
| Is the OSRM demo server reliable for production? | The public demo server is suitable for testing and moderate use. For high-volume or production workloads, consider running your own OSRM instance or using a commercial routing API. |
| How do I format the routes input? | The routes field is a JSON array. Each item must include startLat, startLon, endLat, endLon, and optionally via-points as alternating lat/lon pairs. The input schema includes a prefill example. |
| Can I mix travel profiles in one run? | No. The profile setting applies to all routes in a run. To compare profiles, run the Actor multiple times with different profile values. |
Related actors
Browse the full ParseForge collection for more scrapers.
π Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.
β οΈ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by OSRM Project. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.
Input
| Field | Type | What it does | Default |
|---|---|---|---|
| routes required | array | List of route requests. Each item must include startLat, startLon, endLat, endLon. Optionally add intermediate via-points as alternating lat/lon pairs. | [{"startLat":37.7749,"startLon":-122.419 |
| sectionCaptionRouting | string | Set the travel profile and what extras to return. | not set |
| profile | string (3 options) | Mode of transport. Driving uses car-friendly roads, cycling prefers bike infrastructure, foot uses pedestrian paths. | driving |
| alternatives | boolean | Request up to 3 alternative routes per origin/destination pair (where available). | false |
| steps | boolean | Include detailed step instructions (street names, maneuvers, distances) for each route leg. | true |
| annotations | boolean | Include node IDs, per-segment durations, distances, and speeds for advanced analysis. | false |
| overview | string (3 options) | How detailed the route polyline should be. 'full' returns every coordinate; 'simplified' returns a smoothed path; 'false' omits geometry entirely. | simplified |
| maxItems | integer | Maximum number of routes to collect per run. | 10 |
Pricing
from $28.50 per 1,000 results
| Charged for | What it is | Price each |
|---|---|---|
| result | Single result in the default dataset. | $0.0285 to $0.038 |
Tiered: the lower figure is the price on a higher Apify plan. Billing and the free credit live on Apify.
API
One POST returns the dataset directly. Same shape for every scraper in the library, so swapping the slug is the only change.
curl -X POST "https://api.apify.com/v2/acts/parseforge~osrm-routing-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"helloWorld": 123
}' Examples
Input that runs as-is.
{
"helloWorld": 123
} Reviews
No reviews yet. Be the first.
Issues
We build and maintain this scraper, so a problem with it comes to us. Report it on the Apify listing and the thread stays attached to the scraper where the next person can find it: open an issue.
Broken and urgent, or you would rather not post in public? Write to parseforge@protonmail.com and it reaches the people who wrote it.
