5,000 cities in Spain, ranked by population, as a single downloadable JSON file. No API key, no rate limit, no sign-up โ just a static file you can fetch, cache, or commit straight into your own project.
Data updated: 2026-07-14
Looking for a fuller dataset instead? This file is capped at 5,000 cities with no translations or region data. @geomelon/spain ships19,423 cities (every city with a known population, up to 50,000), 17 regions, and multilingual names as an installable npm package โ npm install @geomelon/spain. See all data packages.
The first few records, largest by population, as they appear in the file:
| City | Region | Population |
|---|---|---|
| Madrid | Community of Madrid | 3,416,771 |
| Barcelona | Catalonia | 1,702,547 |
| Valencia | โ | 825,948 |
| Zaragoza City | Aragon | 666,880 |
| Palma | Balearic Islands | 431,521 |
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Geomelon city ID |
name | string | City name |
population | number | Population |
latitude | number | Latitude |
longitude | number | Longitude |
region | string | null | Region/state name |
A flat, population-ranked file like this is a good fit for offline builds, seed data for a database, a country/city dropdown that doesn't need live search, or a quick lookup table in a script or notebook. It's a static snapshot, not a live feed โ there's no search index, no translations, and no guarantee it reflects changes made to Spain's administrative boundaries after 2026-07-14.
For prefix search, autocomplete, multilingual names, or coordinate-based queries โ anything that needs to stay current or searchable โ use the API instead of the static file:
curl --request GET \
--url 'https://geomelon.p.rapidapi.com/cities/search?countryCode=es&sort=population_desc&limit=10' \
--header 'x-rapidapi-host: geomelon.p.rapidapi.com' \
--header 'x-rapidapi-key: YOUR_API_KEY'This dataset is dedicated to the public domain under CC0 1.0, matching the license of the underlying Wikidata source. You're free to use it for any purpose, including commercially, with no attribution required โ though a link back tothis page is always appreciated.