Blog·Craft·

Nearest city has a limit

Point lookups leave the nearest city null when it is more than 200 km away, while elevation and timezone can still resolve.

A coordinate in the middle of the Atlantic has a nearest city in the mathematical sense. That doesn't make the city a useful label for something that happened there.

/point only fills deep.city when a city is within 200 km. Beyond that, the field is null. The detail is included on every plan. Here is an excerpt from GET /point?lat=30&lon=-40&deep=true:

{
  "latitude": 30,
  "longitude": -40,
  "country": null,
  "timezone": "Etc/GMT+3",
  "deep": {
    "elevation": -3414,
    "city": null
  }
}

The timezone and elevation still resolve because neither depends on finding a city. The timezone is checked at the supplied coordinate, too, so it doesn't accidentally inherit the zone of a city across a boundary.

Even a city inside that 200 km limit is a nearby reference, not proof that the point sits within its municipal boundary. When a city is returned, its distance tells you how far away its coordinates are.

If the nearest city itself is what you're looking for, /city?lat={lat}&lon={lon} searches out to 2,000 km. /point uses the tighter limit because a distant match is easy to mistake for an answer about the location itself.