# GeoNames Places Scraper (`parseforge/geonames-places-scraper`) Actor

Scrapes GeoNames places, postal codes, and country dumps. Returns each place as a flat row with name, coordinates, feature class, population, and country code.

- **URL**: https://apify.com/parseforge/geonames-places-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Education, Travel
- **Features:** Limited permissions
- **Stats:** 3 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $16.00 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner-v4.webp)](https://apify.com/parseforge?fpr=vmoqkp)

### GeoNames Places Scraper

**Scrape GeoNames places, postal codes, and country dumps, up to a million records per run.** Every place comes with its name, coordinates, feature class, population, and country code. No API key or rate limits. Export to CSV, JSON, Excel, or XML.

GeoNames is the world's largest free geographical database, but its API limits you to 30,000 credits per day and 2,000 per hour. This Actor reads the public data dumps directly, so you can pull global cities, every place in a country, or postal codes without a key or quota. Filter by name, feature class, or minimum population and get a flat row per place.

| Who uses it | What they scrape GeoNames for |
|---|---|
| Logistics and e-commerce teams | Validate shipping addresses and normalize place names |
| Market researchers | Build a list of cities or populated places for a region |
| Data engineers | Enrich internal datasets with coordinates and feature classes |
| GIS analysts | Get a clean base layer of places for mapping projects |
| Travel and hospitality apps | Seed a location database with cities and postal codes |

### What it does

This Actor collects GeoNames places by global cities, full country dump, or postal codes per country, and returns each one as a flat row.

- 🌍 **Three modes:** global cities with population 1000 or more, a full per-country dump of all places, or postal codes for one country.
- 🔎 **Name filter:** case-insensitive substring match on name, ASCII name, and alternate names.
- 🏷️ **Feature class filter:** pick populated places, admin divisions, hydrographic, terrain, roads, spots, vegetation, undersea, or parks.
- 👥 **Population filter:** keep only places above a minimum population.
- 📦 **Flat output:** one row per place, ready for CSV, JSON, Excel, or XML.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with GeoNames data

**📦 Validate shipping addresses.**

An e-commerce team pulls all postal codes for a country and cross-checks customer entries before dispatch.

**🗺️ Build a city list for a region.**

A market researcher runs the cities mode with a country filter to get every populated place over 1000 people.

**🧹 Normalize place names in a CRM.**

A data engineer scrapes the full country dump and matches alternate names to clean messy location fields.

**📍 Enrich coordinates for mapping.**

A GIS analyst pulls all places with feature class P and minimum population 5000 to create a base layer.

**✈️ Seed a travel app database.**

A developer runs the cities mode for multiple countries and imports the flat rows into their backend.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key or rate limits** | Reads the public GeoNames data dumps directly, so no registration or daily credit cap. |
| **Up to 1,000,000 places per run** | Set maxItems to pull a small sample or the full dataset. |
| **Three modes, one schema** | Cities, country dumps, and postal codes all return the same flat row shape. |
| **Filter before you download** | Name, feature class, and population filters cut the data to what you need. |
| **Export anywhere** | CSV, JSON, Excel, or XML, ready for your pipeline or spreadsheet. |

### How it compares

This Actor reads the public GeoNames data dumps directly, while Geonames Global Places uses the free GeoNames API with its rate limits and credit system.

| Feature | ParseForge | Geonames Global Places |
|---|---|---|
| Bulk data dumps without API limits | Yes | Not listed |
| Postal codes per country | Yes | Yes |
| Full country dump of all places | Yes | Not listed |
| Filter by feature class | Yes | Not listed |
| Filter by minimum population | Yes | Not listed |
| Timezones and nearby places | Not listed | Yes |

### Configure the run

Drive the Actor from a mode, an optional country, a name query, a feature class, and a minimum population. Filters run as each place is read, so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "maxItems": 10,
  "mode": "cities",
  "country": "US",
  "minPopulation": 0
}
```

A larger pull:

```json
{
  "maxItems": 200,
  "mode": "cities",
  "country": "US",
  "minPopulation": 0
}
```

### Pricing

Pay-per-result: **$0.02133 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $2.13 |
| 1,000 results | $21.33 |
| 10,000 results | $213.30 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [GeoNames Places Scraper](https://apify.com/parseforge/geonames-places-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to GeoNames through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/geonames-places-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check your filters. The name query is a substring match, and the feature class and population filters can exclude everything. Try clearing filters and running again.

**Why is the run slow?**

Large country dumps or high maxItems take longer. Reduce maxItems or add filters to limit the data.

**Why do I get an error about country?**

Country mode and postal codes mode require a country. Select one from the dropdown. Cities mode treats country as optional.

**Can I get all countries at once?**

No. Country and postal codes modes work per country. Use cities mode for global data, or run the Actor multiple times.

**Why are some places missing?**

The data comes from GeoNames dumps. If a place is not in the dump, it will not appear. Check the GeoNames website for coverage.

### FAQ

| Question | Answer |
|---|---|
| Do I need a GeoNames API key? | No. This Actor reads the public data dumps, so there is no key, no registration, and no daily credit limit. |
| What is the difference between the three modes? | Cities mode returns global populated places with population 1000 or more. Country mode returns every place in one country. Postal codes mode returns postal codes for one country. |
| Can I filter by country in cities mode? | Yes. The country field is optional for cities mode and acts as a filter. For country and postal codes modes, it is required. |
| How many places can I get in one run? | You can set maxItems up to 1,000,000. The actual number depends on the mode and filters. |
| What does the name filter match? | It does a case-insensitive substring match on the place name, the ASCII name, and alternate names. |
| What are feature classes? | GeoNames groups places into classes like P for populated places, A for admin divisions, H for hydrographic, T for terrain, and more. You can filter by one class. |
| Can I filter by population? | Yes. Set a minimum population and only places at or above that number are returned. |
| What format is the output? | Each place is a flat row. You can export to CSV, JSON, Excel, or XML from the Apify dataset. |
| Is the data up to date? | The Actor reads the latest public GeoNames data dumps, which are updated regularly by GeoNames. |
| Can I get postal codes for multiple countries? | Postal codes mode works per country. Run the Actor once per country or use multiple runs. |
| Does this include alternate names? | The name filter checks alternate names, and the output includes the primary name and ASCII name. Alternate names are not returned as a separate field. |
| What is the maximum number of places? | You can set maxItems up to 1,000,000. The global cities mode has about 200,000 records, and country dumps vary. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by GeoNames. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `maxItems` (type: `integer`):

How many places to collect per run.

## `mode` (type: `string`):

cities = global populated places ≥1000 (~200K records). country = full per-country dump (all places). postalcodes = postal codes per country.

## `country` (type: `string`):

Required for `country` and `postalcodes` modes. Optional filter for `cities` mode.

## `query` (type: `string`):

Filter by name (case-insensitive substring; matches name + ASCII name + alternate names).

## `featureClass` (type: `string`):

GeoNames feature class. P=populated places, A=admin divisions, H=hydrographic, T=mountain, S=spot, V=vegetation, R=road, U=undersea, L=parks/areas.

## `minPopulation` (type: `integer`):

Filter to places with at least this population. Empty = no filter.

## Actor input object example

```json
{
  "maxItems": 10,
  "mode": "cities",
  "country": "US",
  "query": "",
  "featureClass": "",
  "minPopulation": 0
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "maxItems": 10,
    "mode": "cities",
    "country": "US",
    "query": "",
    "featureClass": "",
    "minPopulation": 0
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/geonames-places-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "maxItems": 10,
    "mode": "cities",
    "country": "US",
    "query": "",
    "featureClass": "",
    "minPopulation": 0,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/geonames-places-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxItems": 10,
  "mode": "cities",
  "country": "US",
  "query": "",
  "featureClass": "",
  "minPopulation": 0
}' |
apify call parseforge/geonames-places-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/geonames-places-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DVfEkIHFxY6ganGbh/builds/LamHINvD3dEBEp9la/openapi.json
