Overview
GeoNames is a geographical database that provides access to a comprehensive collection of location-based information, including names, coordinates, administrative divisions, and feature codes for places across the globe. The project was founded in 2005 with the goal of making geographical data freely available for various applications. It serves as a resource for developers and researchers who need to integrate geospatial capabilities into their projects, particularly those with non-commercial or open-source mandates.
The core offering of GeoNames is its suite of web services, which allows programmatic access to its database. These services include standard geocoding, which converts place names into geographical coordinates, and reverse geocoding, which translates coordinates back into human-readable addresses or place names. Beyond these fundamental operations, GeoNames also supports queries for finding nearby locations, searching for postal codes, retrieving elevation data for specific points, and performing timezone lookups. This range of functionalities makes it suitable for diverse applications, from mapping and navigation tools to data analysis and research projects.
GeoNames is particularly well-suited for academic research, educational tools, and community-driven projects that benefit from open data access. While it offers a free tier with daily and hourly usage limits, commercial applications or those requiring higher query volumes often need to consider premium services or direct data downloads to meet their operational demands. Its comprehensive API documentation outlines the various endpoints and parameters available for each service, enabling developers to integrate geospatial features into their systems. For applications demanding high-volume commercial use or advanced mapping features, alternatives like the Google Maps Platform or Mapbox APIs may offer more scalable solutions, as noted by industry comparisons of geospatial services.
The database itself is a collaborative effort, maintained by a community of contributors and updated regularly. It incorporates data from various official sources and crowd-sourced contributions, aiming for broad coverage and accuracy. This community-driven approach aligns with the project's emphasis on open data and accessibility. Developers utilizing GeoNames often appreciate its straightforward API structure and the breadth of geographical data it provides without requiring extensive licensing agreements for non-commercial use.
Key features
- Geocoding API: Converts place names (e.g., city names, addresses) into geographical coordinates (latitude and longitude) (GeoNames Geocoding documentation).
- Reverse Geocoding API: Translates geographical coordinates into the nearest human-readable place name or address (GeoNames Reverse Geocoding documentation).
- Find Nearby API: Identifies geographical features, places, or points of interest within a specified radius of a given coordinate.
- Postal Code Search: Allows searching for postal codes by location or retrieving location information based on a postal code.
- Elevation Data: Provides elevation information for specific geographical points, useful for mapping and terrain analysis.
- Timezone Lookup: Determines the timezone for any given latitude and longitude coordinate.
- Country and Administrative Division Data: Offers access to information about countries, states, provinces, and other administrative boundaries.
- Wikipedia Article Search: Integrates with Wikipedia to find articles related to geographical features within the GeoNames database.
Pricing
GeoNames operates on a tiered pricing model that differentiates between free web services and premium options for commercial use or higher volume requirements. As of 2026-05-28, the free web services are available with specific daily and hourly limits. Commercial users or those requiring bulk data downloads must opt for premium services or data subscriptions.
| Service Type | Usage Limits | Description |
|---|---|---|
| Free Web Services | Up to 30,000 credits/day, 2,000 credits/hour | Available for most web services; suitable for non-commercial and low-volume applications. |
| Premium Web Services | Higher limits, commercial usage allowed | Requires payment; provides increased request limits and commercial usage rights. |
| Data Downloads | Varies by data set | Available for direct download of the entire GeoNames database or subsets for offline use. Commercial use requires payment. |
For detailed and up-to-date pricing information, including specific costs for premium services and data downloads, refer to the official GeoNames web services overview.
Common integrations
- Mapping Libraries: Integrated with open-source mapping libraries like OpenLayers or Leaflet for displaying geographical data.
- Data Visualization Tools: Used with tools like Tableau or QGIS to enrich datasets with geographical context.
- Web Applications: Incorporated into web applications requiring location search, weather information, or point-of-interest services.
- Mobile Applications: Utilized in mobile apps for location-based services, navigation, or local search functionalities.
- CRM Systems: Can be integrated with CRM platforms like Salesforce to validate or enrich customer address data.
- E-commerce Platforms: Helps with address validation during checkout processes or for calculating shipping zones.
Alternatives
- Google Maps Platform: Offers a comprehensive suite of mapping, geocoding, and location-based services, often preferred for commercial applications requiring high volume and advanced features.
- OpenCage Geocoder: Provides a global geocoding API built on open data sources, with clear pricing and commercial support.
- Mapbox: A platform for custom maps, location search, and navigation, offering robust APIs and SDKs for web and mobile development.
- ArcGIS Platform: Esri's developer platform provides extensive geospatial capabilities, including geocoding, routing, and spatial analysis, often used in enterprise GIS solutions.
- Azure Maps: Microsoft's geospatial platform offering mapping, search, routing, and traffic services, integrated with Azure cloud services.
Getting started
To begin using the GeoNames web services, you typically register for a free account to enable access to most services, although some basic services do not require registration. Once registered, you can start making API requests. The following Python example demonstrates how to perform a simple geocoding query using the GeoNames search service to find information about a city.
import requests
username = "YOUR_GEONAMES_USERNAME" # Replace with your GeoNames username
query = "London"
# GeoNames search service endpoint
url = f"http://api.geonames.org/searchJSON?q={query}&username={username}"
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
data = response.json()
if data and 'geonames' in data and len(data['geonames']) > 0:
first_result = data['geonames'][0]
print(f"City: {first_result.get('name')}")
print(f"Country: {first_result.get('countryName')}")
print(f"Latitude: {first_result.get('lat')}")
print(f"Longitude: {first_result.get('lng')}")
else:
print(f"No results found for {query}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
except ValueError:
print("Failed to decode JSON response.")
This Python script uses the requests library to make an HTTP GET request to the GeoNames searchJSON endpoint. It queries for "London" and then prints the name, country, latitude, and longitude of the first result. Remember to replace "YOUR_GEONAMES_USERNAME" with your actual GeoNames username, which you can obtain by registering on the GeoNames website.