# Safety camera alerts, gated by law before data

`POST /v1/cameras/along` takes a route shape and returns the safety cameras on it: where each camera sits along the route, its type, and the enforced limit where known. The interesting engineering is not the geometry matching. It is the jurisdiction gate in front of it: camera-position warnings are illegal in some countries, so the gateway decides per country whether cameras may be shown at all, before the response is built, and the default is off. Camera alerts are a compliance feature wearing a convenience feature's clothes.

## Why is a camera alert a legal question first?

Whether a navigation client may show camera positions at all varies by country, so the decision is made server-side, per country, and reported in every response. Only countries on an explicit, legally reviewed allowlist, currently the United Kingdom and Ireland, return exact positions. Every other jurisdiction returns nothing, and the reasons differ. Switzerland, Cyprus, North Macedonia, Turkey and the Czech Republic ban camera-warning data outright. France bans signalling exact positions and allows only generalised danger zones. Germany, Denmark and Greece ban the driver's use rather than the distribution, so the feature has to ship off by default there. Spain, the Netherlands, Belgium, Austria, Italy and Portugal are researched as lawful but stay off this endpoint's allowlist until counsel signs each one off. And a country we have not researched at all is treated exactly like a country where the feature is banned, because "probably fine" is not a compliance posture.

The response says what the gate did:

| `policy.mode` | Behaviour |
|---|---|
| `exact` | Exact camera positions are returned. |
| `omitted` | The `cameras` array is empty; only the policy object is returned. |

On routes that cross borders, the gate is finer than the request: each camera is also gated on its own country, so a route that starts in the UK and ends in France returns UK cameras and nothing from the French side. A prohibited neighbour's cameras never leak across the border into an allowed country's response. Clients must not work around the policy with their own camera data, and the [safety-alert design tokens](/docs/maps) follow the same principle: the design layer styles what policy permits and cannot widen it.

## What does the endpoint actually return?

Cameras come back ordered by `arc_m`, the distance in metres along your shape to each camera's on-route projection, in two shapes of record. **Point devices** are a single camera at a position. **Corridors** are a stretch of enforced road, such as average-speed section control; they carry a `zone` object and the arc offsets of both ends (`from_arc_m`, `to_arc_m`). The `shape` parameter is an encoded polyline with six digits of precision, exactly as `POST /route` emits its leg `shape`, and `buffer_m` (the matching corridor's half-width) defaults to 40, with values above 100 clamped to 100.

So a real call is two steps: get a route, feed its shape in. A polyline6 string can contain backslashes, so build the JSON body with `jq` rather than pasting the shape into a quoted string:

```sh
export BASE=https://api.mapmap.ai
export API_KEY=snk_...

SHAPE=$(curl -fsS -X POST "$BASE/route" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"locations":[{"lat":51.5072,"lon":-0.1276},{"lat":52.4862,"lon":-1.8904}],"costing":"auto"}' \
  | jq -r '.trip.legs[0].shape')

jq -n --arg shape "$SHAPE" '{shape: $shape, buffer_m: 40}' \
  | curl -fsS -X POST "$BASE/v1/cameras/along" \
      -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: application/json" \
      -d @-
```

On 25 November 2026 that London to Birmingham route, 190 km, came back with 79 fixed cameras. The first two, with the policy and the attribution:

```json
{
  "cameras": [
    { "arc_m": 5446.5, "lat": 51.5334906, "lon": -0.173198,
      "kind": "fixed", "limit_kph": 32, "bearing": null,
      "limit_confidence": "unknown" },
    { "arc_m": 6005.1, "lat": 51.5378918, "lon": -0.1761386,
      "kind": "fixed", "limit_kph": 32, "bearing": null,
      "limit_confidence": "unknown" }
  ],
  "attribution": [
    "© OpenStreetMap contributors, licensed under ODbL 1.0 ... https://www.openstreetmap.org/copyright"
  ],
  "policy": { "country": "GB", "mode": "exact" }
}
```

The attribution is shortened here; display the string the response carries. A route from central Paris on the same day came back `{"country": "FR", "mode": "omitted"}` with an empty array, which is the gate doing its job.

Three details earn their place. `limit_kph` is `null` whenever the data records no limit, which is common and honest rather than an error, and we never substitute a guess, with `limit_confidence` (`official`, `osm`, `inferred_from_road` or `unknown`) saying how far a stated limit can be trusted. Cameras facing away from the direction of travel, more than 60 degrees off the local route bearing, are filtered out server-side, so the opposite carriageway's cameras do not fire alerts. And a corridor is always one entry, never one per device: alerting per device on a section-control stretch would warn the driver several times for a single enforcement event.

## Where does the data come from, and under what licence?

Within one territory the data is either OpenStreetMap-derived or published by the enforcing authority, and never a mixture. Everywhere we serve today, the UK's fixed cameras included, the source is OpenStreetMap under ODbL 1.0. For Ireland we have built the ingestion of An Garda Síochána's published mobile safety camera zones, 1,916 corridors, plus the published fixed and average-speed cameras, 11 devices, under CC BY 4.0 as Irish public sector information, with OSM camera nodes excluded entirely. That Irish data is not loaded on our hosted gateway yet, which the limits below spell out.

The no-mixing rule is a licence requirement, not a preference. Combining OSM and non-OSM records of the same feature type over the same area would make the whole dataset an ODbL derivative with share-alike, which is exactly the entanglement the per-territory separation avoids. Every response carries an `attribution` array listing the notices the returned data obliges; display them verbatim. Map data © OpenStreetMap contributors.

## What it costs and what it does not do

A cameras call bills as one **Standard** call, never Premium: it is a safety feature and carries no extra charge. On [our published pricing](/pricing) that means it comes out of the 50,000 free monthly calls, then 0.05p per call in the first pay-as-you-go band.

The limits, honestly:

- **Exact positions are allowed for the UK and Ireland only.** Everywhere else `policy.mode` is `omitted` and the array is empty, by design, until a jurisdiction passes legal review.
- **Ireland is allowed but not loaded on our hosted gateway.** An Irish route comes back `policy.mode: "exact"` with an empty `cameras` array: on 25 November two routes out of Dublin, one to Galway and one south-west towards Kildare, both returned nothing. That means "nothing loaded here", not "no cameras here". Which territories a deployment has loaded is a deployment fact, so read the array and the policy together rather than assuming coverage.
- **The hosted UK file predates per-record provenance.** Its records carry no `source` or `licence` field, and `limit_confidence` reads `unknown` on every one, even where a `limit_kph` is present, until the territory is rebaked. The `attribution` array is returned either way.
- **On deployments without camera data the endpoint answers `501`** with problem type `urn:sn-gateway:problem:cameras-not-enabled`. Treat that as "feature not available here" and disable camera alerts, not as an error. Self-hosters enable it by pointing `SN_CAMERAS_DIR` at the per-territory `cameras.json` sidecars the data factory's `safety-cameras` stage produces; the wider self-host picture is in the [self-hosting guide](/docs/self-host).
- **`limit_kph` is often `null`**, so an average-speed calculation or overspeed comparison must tolerate its absence.
- **Corridors carry no bearing**, because they are enforced in both directions; only point devices are direction-filtered.

## Try it

The two-step call above works with any verified key against the production gateway, and on its London to Birmingham route you get UK fixed cameras back. The full parameter table, corridor field reference and jurisdiction policy live in the [analysis API documentation](/docs/analysis), and if you are building alerts into a client, the `extra.nav.alerts` theme block gives you the chip colours, icon set, earcons, lead distance and per-kind rules to render them against, documented on the [maps page](/docs/maps). The design brief it follows is the same one as the gate: calm within the limit, urgent over it, and silent wherever the law says so.
