Open-Meteo Geocoding

Geocoding · No API Key Required · Works Globally

TL;DR

What it does: Turns any city name into GPS coordinates. Search "Tokyo" and get latitude 35.69, longitude 139.69. Also returns country, timezone, elevation, and population.

Quick start: curl "https://geocoding-api.open-meteo.com/v1/search?name=Tokyo&count=3"

No API key needed - works for any city worldwide

Overview

Open-Meteo Geocoding converts human-readable city names into precise GPS coordinates. It covers every country on Earth and returns rich data including country, timezone, elevation above sea level, and population for each match. It handles misspellings, diacritics (Montreal / Montreal), and partial names. The API is designed as the companion to Open-Meteo Weather — geocode a city first, then pass the coordinates to get the forecast.

Live Example

Here's the exact URL to call and the real response you'll get:

The URL to call (search Tokyo):

https://geocoding-api.open-meteo.com/v1/search?name=Tokyo&count=1
Try This URL Now →

The actual response you get:

{
  "results": [
    {
      "id": 1850147,
      "name": "Tokyo",
      "latitude": 35.6895,
      "longitude": 139.69171,
      "elevation": 44.0,
      "feature_code": "PPLC",
      "country_code": "JP",
      "admin1_id": 1850144,
      "timezone": "Asia/Tokyo",
      "population": 9733276,
      "country_id": 1861060,
      "country": "Japan",
      "admin1": "Tokyo"
    }
  ],
  "generationtime_ms": 0.71
}

What does this data mean?

Tokyo, Japan's capital: 35.69°N, 139.69°E, population 9.7 million, in the Asia/Tokyo timezone.

name
The matched city name — "Tokyo" (matches your search, handles misspellings and diacritics)
latitude, longitude
GPS coordinates — 35.6895, 139.69171. Pass these to the weather API to get Tokyo's forecast
country, country_code
Country name and ISO code — "Japan", "JP". Useful for flags, country filters, regional apps
timezone
IANA timezone — "Asia/Tokyo" (UTC+9). Essential for presenting times in local context
elevation
Height above sea level in meters — 44.0m. Tokyo is near sea level, other cities vary widely
population
City population — 9,733,276. Helps rank results and identify major vs minor locations
feature_code
Type of location — "PPLC" means capital city (PPLC = populated place capital). Other codes: PPL (city), PPLA (regional capital)
admin1
First-level administrative division — "Tokyo" prefecture. For other cities this could be a state, province, or region

How to use this API

JavaScript Example

const city = "Tokyo";
const url = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(city)}&count=5`;

fetch(url)
  .then(res => res.json())
  .then(data => {
    data.results.forEach(place => {
      console.log(`${place.name}, ${place.country}: ${place.latitude}, ${place.longitude} | ${place.timezone}`);
    });
  })
  .catch(err => console.error(err));

Python Example

import requests

city = "Tokyo"
params = {"name": city, "count": 5}
url = "https://geocoding-api.open-meteo.com/v1/search"

response = requests.get(url, params=params)
data = response.json()

for place in data["results"]:
    print(f"{place['name']}, {place['country']}: "
          f"{place['latitude']}, {place['longitude']}")

cURL Example

# Search Tokyo
curl "https://geocoding-api.open-meteo.com/v1/search?name=Tokyo&count=3"

# Search with misspelling (handles it)
curl "https://geocoding-api.open-meteo.com/v1/search?name=Angeles"

# Search with diacritics
curl "https://geocoding-api.open-meteo.com/v1/search?name=Montr%C3%A9al"

# Get single best match
curl "https://geocoding-api.open-meteo.com/v1/search?name=Paris&count=1"

Frequently Asked Questions

Do I need an API key?
No. Open-Meteo Geocoding requires zero authentication. Just construct the URL and call it.
How do I convert a US city name to coordinates?
Same as any city: ?name=Los+Angeles. Results include the country_code "US" and the state in the admin1 field.
Can I limit results?
Yes. Use count parameter (default 10, max 100). count=1 for the best match, count=100 for all possibilities.
Does it handle misspellings?
Yes. Searching "Angeles" still finds Los Angeles. Diacritics work too — "Montreal" and "Montréal" both find Montreal, Canada.
What coordinate system does it use?
WGS84 (World Geodetic System 1984), the standard GPS coordinate system used by maps, phones, and aviation worldwide.
How do I get weather for a city after geocoding?
Take the latitude and longitude, then call Open-Meteo Weather: /v1/forecast?latitude=35.69&longitude=139.69 for Tokyo's weather.

API Details

Base URL
https://geocoding-api.open-meteo.com/v1/search
Documentation
https://open-meteo.com/en/docs/geocoding
Category
Geocoding
Authentication
None required - completely free
Coverage
Worldwide - all countries, 200+ territories
Parameters
name (required), count (optional, max 100), language (optional)
CORS
Yes