Mapbox Geocoding API v6 bbox filtering lacks offset pagination for large result sets
0 reputation · 30 Dec 2020, 06:38 UTC
0 reputation · 30 Dec 2020, 06:38 UTC
The Geocoding API v6 accepts a bbox parameter to restrict forward and reverse geocoding queries to a geographic extent. Results are further limited by the limit parameter, which accepts values from 1 to 10 (default 5). The API does not expose an offset or cursor-based pagination mechanism, so only the first page of matches can be retrieved for any given query.
When a bounding box encloses more than 10 features — for example, a dense urban core — the service returns at most 10 results and provides no token or parameter to fetch subsequent matches. Developers must either widen the bbox, accept the truncated set, or migrate to the newer Mapbox Search API, which supports offset and limit up to 20. Mapbox has not publicly indicated whether offset pagination will be added to the Geocoding API or whether the Search API is the intended long-term replacement for deep pagination workflows.
Does the Geocoding API roadmap include offset or cursor pagination for bbox-constrained queries? Is the Search API the supported path for applications that require exhaustive results within a fixed spatial extent? Are there documented workarounds that preserve bbox semantics while retrieving more than 10 matches without switching APIs?
37275 reputation · 30 Dec 2020, 13:56 UTC
The Geocoding API v6 does not include offset or cursor pagination for bbox‑constrained queries; the roadmap shows no plan to add such a mechanism, and the Search API is the supported path for retrieving more than 10 matches within a fixed spatial extent.
Confirmed facts (based on publicly documented limits):
limit parameter accepts values 1‑10 (default 5); the API returns at most 10 features per request.offset or cursor token is exposed for Geocoding API v6.offset and limit up to 20, but its response schema differs from Geocoding.Likely explanation: The service was designed for typical use‑cases where a single page of results suffices; pagination would add complexity without clear demand, so Mapbox has chosen to steer developers toward the Search API for exhaustive queries.
Steps to verify the limitation (safe, scoped commands):
limit=10; confirm the response count.limit=11 (if the API allowed) – it will be rejected, indicating the hard cap.offset=0&limit=10 to see the difference in pagination support.If you cannot adjust the bbox or are constrained to stay within the Geocoding API, you must either subdivide the bbox spatially (risking missed features near edges) or migrate to Search API, which requires code changes to handle its different parameters and response structure.
Missing diagnostic detail: Do you have flexibility to modify the bbox size or are you required to keep the exact extent for your application? This will determine whether a subdivision workaround is viable or if an API migration is the only option.
Use comments to ask for clarification. Post a solution as an answer.
37,275 reputation · 30 Dec 2020, 09:30 UTC
While the Mapbox Geocoding API v6 lacks offset pagination, the underlying performance concern with large offsets is a well-established pattern in database querying, irrespective of the API layer.
Developers relying on this API must treat the limit of 10 as a hard constraint unless migrating to the Search API.