Search code examples
mapboxgeojsongeocodingmapbox-gl-jsmapbox-api-geocoding

Does Mapbox geocoding API support intersections outside US?


According to the Mapbox geocoding API docs, it supports searching for intersections of two roads through the following API call:

https://api.mapbox.com/geocoding/v5/{endpoint}/{street_1}%20and%20{street_2}.json

The example listed in the docs (Market Street / Fremont Street, San Francisco) works:

$ curl "https://api.mapbox.com/geocoding/v5/mapbox.places/Market%20Street%20and%20Fremont%20Street.json?types=address&proximity=-122.39738575285674,37.7925147111369453&access_token=[TOKEN]"

{
  "type": "FeatureCollection",
  "query": [
    "market",
    "street",
    "and",
    "fremont",
    "street"
  ],
  "features": [
    {
      "id": "address.826558382307746",
      "type": "Feature",
      "place_type": [
        "address"
      ],
      "relevance": 1,
      "properties": {
        "accuracy": "intersection"
      },
      "text": "Fremont Street",
      "place_name": "Market Street and Fremont Street, San Francisco, California, United States",
      "center": [
        -122.3982976,
        37.791734
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.3982976,
          37.791734
        ]
      },
      ...
    },
    ...
  ]
}

but when I search for somewhere outside the US (e.g. King Street / Collins Street, Melbourne), it never returns an intersection:

$ curl "https://api.mapbox.com/geocoding/v5/mapbox.places/William%20Street%20and%20Collins%20Street.json?access_token=[TOKEN]&country=au&types=address&proximity=144.95979,-37.81638"

{
  "type": "FeatureCollection",
  "query": [
    "william",
    "street",
    "and",
    "collins",
    "street"
  ],
  "features": [
    {
      "id": "address.6899530118768598",
      "type": "Feature",
      "place_type": [
        "address"
      ],
      "relevance": 0.716667,
      "properties": {
        "accuracy": "street"
      },
      "text": "Williams Street",
      "place_name": "Williams Street, St Arnaud Victoria 3478, Australia",
      "center": [
        143.25317765,
        -36.62076935
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          143.25317765,
          -36.62076935
        ]
      },
      ...
    },
    ...
  ]
}

As far as I can tell, the geocoding intersection search only works for US-based addresses. I've tried different combinations of the country, proximity and bbox parameters to no success.

US-based addresses work:

  • "Market Street and Fremont Street, San Francisco" (used in the docs example)
  • "Broadway and Columbus Avenue, New York"

Non US-based addresses don't work at all:

  • "Collins Street and William Street, Melbourne"
  • "Eagle Street and Queen Street, Brisbane"
  • "George Street and Grosvenor Street, Sydney"
  • "Oxford Street and Tottenham Court Road, London"
  • "Avenue Des Champs-Élysées and Place Charles de Gaulle, Paris"

How do I get Mapbox geocoding intersection search to work for non-US addresses?

If this is not possible, is it documented anywhere? Nothing in the docs indicates that this is not available world-wide, and I can't think of any reason why it wouldn't be.


Solution

  • You can use Mapbox's geocoding API playground to try various queries. Based on my testing, it seems clear that intersection queries always resolve to the US, or to something other than an intersection.

    So:

    How do I get Mapbox geocoding intersection search to work for non-US addresses?

    I doubt it is possible.

    If this is not possible, is it documented anywhere?

    Not that I can see.

    Nothing in the docs indicates that this is not available world-wide, and I can't think of any reason why it wouldn't be.

    Geocoders are built from lots of different data sources in different regions, with lots of different rules.

    It's hard to imagine why Mapbox would deliberately introduce this limitation, but easy to imagine how it could unintentionally come to be. You may wish to contact them directly.