Skip to content

Add support for the Geocoding API - #54

Merged
dblock merged 1 commit into
masterfrom
add-geocoding-api
Aug 27, 2026
Merged

Add support for the Geocoding API#54
dblock merged 1 commit into
masterfrom
add-geocoding-api

Conversation

@dblock

@dblock dblock commented Aug 27, 2026

Copy link
Copy Markdown
Owner

What

Adds support for OpenWeather's Geocoding API, the currently supported method for converting city names/zip codes to geo-coordinates and back (replacing the deprecated built-in geocoding baked into the Current Weather API).

  • client.geo_direct(name, state, country, options) — direct geocoding, city/state/country name to coordinates (GET geo/1.0/direct).
  • client.geo_reverse(lat, lon, options) — reverse geocoding, coordinates to location name (GET geo/1.0/reverse).
  • client.geo_zip(zip, country, options) — zip/post code to coordinates (GET geo/1.0/zip).
  • Adds OpenWeather::Models::GeoLocation (used by geo_direct/geo_reverse, an array result) and OpenWeather::Models::GeoLocationZip (used by geo_zip, a single result), matching the differing response shapes documented by OpenWeather.
  • Adds a geo_endpoint config attribute (defaults to https://api.openweathermap.org/geo), since the Geocoding API is hosted at a different base path than /data.
  • Adds README documentation and a CHANGELOG entry.

Why

Closes #47. Current Weather's built-in city name/zip code lookup no longer receives bug fixes and OpenWeather recommends the Geocoding API instead.

Testing

Added specs with VCR cassettes recorded against the live Geocoding API. Full suite: 122 examples, 0 failures, 100% line coverage.

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@dblock
dblock force-pushed the add-geocoding-api branch from 39661d7 to 5b0d040 Compare August 27, 2026 23:23
Closes #47.

* Adds `geo_direct`, `geo_reverse` and `geo_zip` client methods wrapping
  OpenWeather's Geocoding API (https://openweathermap.org/api/geocoding-api),
  the currently supported way to convert city names/zip codes to
  coordinates and back, replacing the deprecated built-in geocoding in
  the Current Weather API.
* Adds `OpenWeather::Models::GeoLocation` and
  `OpenWeather::Models::GeoLocationZip`.
* Adds a `geo_endpoint` config attribute, defaulting to
  `https://api.openweathermap.org/geo`.
* Adds README documentation and a CHANGELOG entry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock force-pushed the add-geocoding-api branch from 5b0d040 to f432341 Compare August 27, 2026 23:25
@dblock
dblock merged commit 5bd8b93 into master Aug 27, 2026
19 checks passed
@dblock
dblock deleted the add-geocoding-api branch August 27, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Geocoding API

1 participant