Skip to main content

Overview

Breeze uses the Open-Meteo Geocoding API to enable users to search for cities by name and retrieve their geographic coordinates. This powers the location search functionality throughout the app.

Base URL

Endpoints Used

Search Cities by Name

Searches for cities matching a query string and returns up to 5 results. Query Parameters:

Response Format

The API returns a JSON response with an array of matching cities:

Response Model

Breeze decodes the response into these Swift models:

Usage Example

Here’s how Breeze searches for cities:
See GeocodingService.swift:10

Search Behavior

Minimum Query Length

Breeze requires at least 2 characters before triggering a search to prevent unnecessary API calls and improve user experience.

Result Limit

The app requests a maximum of 5 results to keep the search interface clean and focused on the most relevant matches.

Display Format

City results are displayed in the format: City, State/Region, Country Examples:
  • “San Francisco, California, United States”
  • “Paris, Île-de-France, France”
  • “Tokyo, Tokyo, Japan”

Response Fields

Error Handling

The service handles several error cases:
  • Empty query or too short: Returns empty array without making API call
  • Invalid URL: Throws URLError(.badURL)
  • Bad response: Throws URLError(.badServerResponse)
  • No results: Returns empty array (when results field is nil)

Integration Points

The geocoding service is used in:
  1. City Search Interface: User-facing search bar for finding locations
  2. Location Selection: Converting user input to coordinates
  3. Dashboard: Displaying selected city information

Rate Limits

Open-Meteo APIs are free and do not require an API key. They have generous rate limits suitable for interactive search experiences.

Reference