Get Zone Trip Volume
curl --request GET \
--url https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"feasibility": "high",
"hourly_activity": [
{
"hour": 8,
"total_trips": 2805,
"trip_ends": 1385,
"trip_starts": 1420
},
{
"hour": 18,
"total_trips": 3272,
"trip_ends": 1662,
"trip_starts": 1610
}
],
"message": "Trip volume from real zone_trip_flows counts (n_trip_starts / n_trip_ends), aggregated to the requested geohash precision.",
"zone_total_activity": [
{
"avg_vehicle_count": 6.2,
"context": {
"population": 655,
"top_pois": [
{
"category": "transportation",
"count": 22
},
{
"category": "sustenance",
"count": 19
}
],
"transit_stops_total": 14
},
"geom": {
"coordinates": [
[
[
9.2038,
45.48477
],
[
9.20517,
45.48477
],
[
9.20517,
45.48615
],
[
9.2038,
45.48615
],
[
9.2038,
45.48477
]
]
],
"type": "Polygon"
},
"total_trips": 2214,
"trip_ends": 1034,
"trip_starts": 1180,
"zone_id": "u0ndc2q",
"zone_label": "u0ndc2q",
"zone_latitude": 45.48546,
"zone_longitude": 9.20448
},
{
"avg_vehicle_count": 8.9,
"context": {
"population": 412,
"top_pois": [
{
"category": "sustenance",
"count": 64
},
{
"category": "shop",
"count": 51
},
{
"category": "tourism",
"count": 12
}
],
"transit_stops_total": 9
},
"geom": {
"coordinates": [
[
[
9.18869,
45.46417
],
[
9.19006,
45.46417
],
[
9.19006,
45.46555
],
[
9.18869,
45.46555
],
[
9.18869,
45.46417
]
]
],
"type": "Polygon"
},
"total_trips": 1957,
"trip_ends": 995,
"trip_starts": 962,
"zone_id": "u0nd9he",
"zone_label": "u0nd9he",
"zone_latitude": 45.46486,
"zone_longitude": 9.18938
}
]
}Zone Based Analytics
Get Zone Trip Volume
Trip starts and ends per zone and per hour of the day for a free-floating service, from recorded trips. Zones are geohash cells (default precision 7, about 150 m) with their centroid, boundary and, when available, population, public-transit stops and top points of interest. Zones are sorted by total trips.
Failure Modes:
- 400:
precisiongiven with a zoning system other thangeohash7 - 401: Token is missing or invalid
- 403: Insufficient permissions
- 404:
no_data_bindingwhen the provider or location is not enabled for your company - 422: Invalid filter parameters
Required Auth Scopes:
copilot:analytics
GET
/
copilot
/
zone-based
/
{provider}
/
trip_volume
Get Zone Trip Volume
curl --request GET \
--url https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/copilot/zone-based/{provider}/trip_volume"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"feasibility": "high",
"hourly_activity": [
{
"hour": 8,
"total_trips": 2805,
"trip_ends": 1385,
"trip_starts": 1420
},
{
"hour": 18,
"total_trips": 3272,
"trip_ends": 1662,
"trip_starts": 1610
}
],
"message": "Trip volume from real zone_trip_flows counts (n_trip_starts / n_trip_ends), aggregated to the requested geohash precision.",
"zone_total_activity": [
{
"avg_vehicle_count": 6.2,
"context": {
"population": 655,
"top_pois": [
{
"category": "transportation",
"count": 22
},
{
"category": "sustenance",
"count": 19
}
],
"transit_stops_total": 14
},
"geom": {
"coordinates": [
[
[
9.2038,
45.48477
],
[
9.20517,
45.48477
],
[
9.20517,
45.48615
],
[
9.2038,
45.48615
],
[
9.2038,
45.48477
]
]
],
"type": "Polygon"
},
"total_trips": 2214,
"trip_ends": 1034,
"trip_starts": 1180,
"zone_id": "u0ndc2q",
"zone_label": "u0ndc2q",
"zone_latitude": 45.48546,
"zone_longitude": 9.20448
},
{
"avg_vehicle_count": 8.9,
"context": {
"population": 412,
"top_pois": [
{
"category": "sustenance",
"count": 64
},
{
"category": "shop",
"count": 51
},
{
"category": "tourism",
"count": 12
}
],
"transit_stops_total": 9
},
"geom": {
"coordinates": [
[
[
9.18869,
45.46417
],
[
9.19006,
45.46417
],
[
9.19006,
45.46555
],
[
9.18869,
45.46555
],
[
9.18869,
45.46417
]
]
],
"type": "Polygon"
},
"total_trips": 1957,
"trip_ends": 995,
"trip_starts": 962,
"zone_id": "u0nd9he",
"zone_label": "u0nd9he",
"zone_latitude": 45.46486,
"zone_longitude": 9.18938
}
]
}Authorizations
HTTPBearerHTTPBearer
Path Parameters
Identifier of the mobility provider whose data you analyse, e.g. acme-bikes. It must be the provider of a data source enabled for your company's zone-based analytics; any other value is refused with 404 no_data_binding (kind: source). Your SWITCH contact tells you the provider identifiers and locations enabled for your company.
