TL;DR
Open-Meteo's free geocoding API converts city names into GPS coordinates (latitude/longitude), country codes, admin divisions, and timezone IDs. It's designed as the perfect companion to the Open-Meteo Weather API — search for a city first, then plug the coordinates into the weather forecast endpoint. No API key, no signup, no rate limits.
Quick start: https://geocoding-api.open-meteo.com/v1/search?name=Los+Angeles&count=1
No API key needed — just make a request!
How to Use This API
1. Search for a City
Search for "Los Angeles" and return the best match:
https://geocoding-api.open-meteo.com/v1/search?name=Los+Angeles&count=1
Parameters: name is the city name (URL-encoded). count limits results (default 10, max 100). language can be set to en, de, fr, etc. for localized results.
2. Get Multiple Results for Ambiguous Names
There are 30+ "Springfield" locations worldwide — get them all:
https://geocoding-api.open-meteo.com/v1/search?name=Springfield&count=10&language=en
Each result includes country, admin1 (state/province), country_code, latitude, longitude, elevation, and timezone — enough to disambiguate.
3. JavaScript — Geocode + Weather in One Flow
async function getWeatherForCity(city) {
const geo = await fetch(
'https://geocoding-api.open-meteo.com/v1/search?name=' +
encodeURIComponent(city) + '&count=1'
).then(r => r.json());
const loc = geo.results[0];
const weather = await fetch(
'https://api.open-meteo.com/v1/forecast?latitude=' +
loc.latitude + '&longitude=' + loc.longitude +
'¤t=temperature_2m,wind_speed_10m'
).then(r => r.json());
console.log(loc.name + ', ' + loc.country + ': ' +
weather.current.temperature_2m + '°C');
}
getWeatherForCity('Tokyo');
4. Python — Find Cities and Their Coordinates
import requests
resp = requests.get(
'https://geocoding-api.open-meteo.com/v1/search',
params={'name': 'Paris', 'count': 5, 'language': 'en'}
)
data = resp.json()
for r in data['results']:
print(f"{r['name']}, {r.get('admin1', '')}, {r['country']} "
f"→ {r['latitude']}, {r['longitude']} "
f"({r['elevation']}m, tz: {r['timezone']})")
https://geocoding-api.open-meteo.com/v1/search?name=Los+Angeles&count=1
Frequently Asked Questions
- Why use this over Google Maps Geocoding?
- No API key, no billing, no rate limits. Open-Meteo Geocoding is completely free and open-source. It's less comprehensive (no street addresses), but perfect for city-level geocoding needed by weather apps.
- What data does a result contain?
- Each result includes:
id,name,latitude,longitude,elevation,country,country_code,admin1(state/region),admin2(district),timezone, andpopulation— everything needed for weather lookups. - How many cities does it cover?
- The dataset includes over 3 million locations worldwide from GeoNames, with a focus on populated places. Rural areas and small villages may not be indexed, but most cities and towns are.
- Does it support reverse geocoding?
- Not directly. For reverse geocoding (coordinates to city name), you would need a different API like Nominatim. Open-Meteo's geocoding is forward-only.
- How do I handle cities with the same name?
- Use the
countparameter to get multiple results, then pick by country_code or admin1. For example, "London" returns entries for UK, Canada, and the US — filter withcountry_code=GB. - Is there an autocomplete endpoint?
- The
/searchendpoint works as you type — it returns partial matches sorted by population and relevance. You can use it to build a city autocomplete widget in your frontend.
API Details
- API URL
https://geocoding-api.open-meteo.com/v1/search- Documentation
- open-meteo.com/en/docs/geocoding
- Category
- Geocoding
- Authentication
- Not Required
- Geographic Coverage
- Global — 3M+ locations from GeoNames
What You Can Build
- City search widget for any weather or map application
- Combined geocode+weather API wrapper that accepts city names
- Travel planner that looks up timezone and elevation for destinations
- Population browser — search cities sorted by population size
- Multi-city weather dashboard where users type city names