Offline City Geocoder: City Name to Coordinates avatar

Offline City Geocoder: City Name to Coordinates

Pricing

from $0.09 / 1,000 resolved location

Go to Apify Store
Offline City Geocoder: City Name to Coordinates

Offline City Geocoder: City Name to Coordinates

Turn messy city text like "Austin, TX", "München" or "서울" into coordinates, country, region, population and time zone. Runs fully inside the Actor: no API key, no outside calls, no rate limits.

Pricing

from $0.09 / 1,000 resolved location

Rating

0.0

(0)

Developer

Henry Kang

Henry Kang

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

7 days ago

Last modified

Features

Limited permissions

Share

Turn messy place text such as "Austin, TX", "München", "Toronto, ON", "Sài Gòn" or "서울특별시" into coordinates, country, region, population and IANA time zone. Everything runs inside the Actor. There is no API key, no call to an outside geocoding service, and no rate limit. City level only: no street addresses or postal codes. $0.085 per 1,000 resolved locations; texts that are not resolved are free. Give the texts as a JSON list in Locations (one entry per text). Reading place texts straight from another Apify dataset is not offered in this version.

What you get for each text

FieldExampleMeaning
queryAustin, TXYour text
statusokok, not_found, country_only, region_only or invalid_input. Only ok is charged
matchedNameAustinThe city that was matched
countryCode, countryNameUS, United StatesCountry, with the name in the language you choose
admin1, admin1CodeTexas, TXFirst-level region (state, province)
latitude, longitude30.26715, -97.74306City coordinates
population974447Population from GeoNames
timezoneAmerica/ChicagoIANA time zone of the city
geonameId4671654GeoNames ID, handy for joins
confidencehighhigh, medium or low, depending on how clearly one city wins
candidates6How many cities share the matched name, before hints are applied
alternatives[...]Up to three other cities with the same name (can be turned off)
hintsIgnored["Atlantis"]Parts of your text that did not match any country or region

What it understands

  • City names in many languages and scripts: "München" and "Munich", "서울" and "Seoul", "東京" and "Tokyo", "Sài Gòn" and "Ho Chi Minh City". Accents are optional: "Sao Paulo" finds "São Paulo".
  • Country and region hints after a comma: "Paris, TX", "Melbourne, VIC", "Toronto, ON", "London, UK", "Munich, Germany".
  • Hints without a comma: "Paris TX", "Berlin Germany".
  • Postal codes next to a hint are skipped: "Paris, TX 75460" still uses the "TX" hint.
  • Everyday extras: "Greater London", "Greater Seattle Area", "Bay Area", "New York City", "서울특별시", "부산광역시".
  • Ambiguous names are resolved toward the larger and more important city, unless a hint says otherwise. "Springfield, IL" gives Springfield, Illinois. Check confidence and alternatives when it matters.
  • A country value in an entry (for example {"query": "Paris", "country": "US"}) is used as a hint. A default country can be set for data from one country.

What is not charged:

  • Texts that only name a country ("Germany", "Brazil", "Mexico", "Panama") come back as country_only, not as the capital. City states ("Singapore", "Monaco", "Hong Kong") are matched as cities.
  • Texts that only name a state or region ("California, United States", "West Virginia", "Florida"), or only a state code ("WA", "NSW"), come back as region_only. They are not matched to small towns that happen to share the name. Capitals and cities of 1,000,000+ people that share a region's name ("New York", "Seoul") are still treated as cities.
  • When a name is a city in one country and a region or a country elsewhere, a hint decides. "Manchester, UK" (or "country": "GB") is the city in England; "Manchester, Jamaica" is the parish and comes back as region_only. "Granada, Spain" is the city, not Grenada. Without a hint, the city is chosen when a city with exactly that name has more people than all listed towns of the region together ("Manchester", "Portland", "Southampton"); otherwise the result is region_only ("Canterbury" gives the New Zealand region, "Canterbury, UK" the city).
  • If a hint names a real country or region but no city of that name is there ("Paris, Japan"), the result is not_found.
  • Placeholders and world regions ("Remote", "TBD", "None", "N/A", "Headquarters", "Home", "APAC", "EU", "Africa", "Central America") come back as not_found.

How to use it

1. Paste texts

{
"locations": [
"Austin, TX",
"München",
{ "id": "row-17", "query": "Springfield", "country": "US" },
"서울특별시"
]
}

2. Call it from your code, an integration, or an AI agent

Run it through the Apify API, from Make, Zapier or n8n, on a schedule, or as a tool for AI agents through the Apify MCP server.

Output example

{
"inputIndex": 0,
"id": null,
"query": "Austin, TX",
"status": "ok",
"message": null,
"matchedName": "Austin",
"countryCode": "US",
"countryName": "United States",
"admin1": "Texas",
"admin1Code": "TX",
"latitude": 30.26715,
"longitude": -97.74306,
"population": 974447,
"timezone": "America/Chicago",
"geonameId": 4671654,
"confidence": "high",
"candidates": 6,
"hintsIgnored": null,
"alternatives": []
}

(candidates is 6 because six cities called Austin are known. The "TX" hint leaves only the one in Texas, so alternatives is empty. This example was made with our test copy of the data; on Apify the data is newer, so numbers such as population can differ.)

Pricing

$0.085 per 1,000 resolved locations ($0.000085 each). For example, 10,000 resolved locations cost $0.85. Each run also has the standard Apify start fee of $0.00005 (charged once per GB of memory, so $0.00005 at the default 1 GB). Texts that are not found, only name a country or a region, or are empty are not charged. If you set a maximum cost per run, the Actor stops cleanly when that amount is reached.

Speed

In a local test on a laptop, the city index loaded in about 1 second, and matching 19,200 texts took about 1 second (matching only, before results are saved). On Apify, two test runs with 1,000 texts each took 3.4 and 5.4 seconds in total, start-up included. Speed on Apify depends on the memory you choose.

Good to know

  • This is a city-level geocoder. It does not find street addresses, postal codes, districts, landmarks or businesses.
  • It knows the places in GeoNames' cities1000 list (in the data downloaded on 2026-11-24: about 172,000 places with about 830,000 names). Very small villages may be missing.
  • Each entry must be a text or an object with a query text. Other values come back as invalid_input (not charged).
  • Coordinates are the city's reference point from GeoNames, not a boundary.
  • When a name is shared by several cities and there is no hint, the answer can be wrong. Use hints, a country value in the entry, or defaultCountry, and check confidence and alternatives. For example, "San Jose" alone gives San José, Costa Rica (a capital), and "Victoria" alone gives Hong Kong, whose alternate names include Victoria. "San Jose, CA" and "Victoria, BC" give the cities in the US and Canada.
  • A text of 3 Latin letters or fewer that matches a town only through an alternate name, with no hint, gets confidence: "low", because such matches are often airport or other codes. The match is still charged. Short names in other scripts, such as "東京", keep their normal confidence.
  • Two-letter texts that are also country codes (for example "DE" or "IN") come back as country_only. "LA" and "DC" are read as Los Angeles and Washington, D.C., and are charged. If "LA" in your data means Louisiana, put it after the city ("Baton Rouge, LA").

Data sources and licences

  • Cities, alternate names and regions: GeoNames, CC BY 4.0. The latest data is downloaded each time the Actor is built. Changes made: reduced to the fields this Actor uses, names normalized and indexed. If the download fails, the build stops, so an old copy is never used by accident. The run's SUMMARY record (in the key-value store) gives the data source and the time it was built.
  • Test data: the GeoNames copy in the geonamescache package (MIT), used only in local tests.
  • Country names: Unicode CLDR, through the babel package.

FAQ

Is my data sent anywhere? No. All matching happens inside the run.

Can I get the result in CSV or Excel? Yes. Export the run's dataset in any format that Apify offers.

A city is matched wrongly. Open an issue on the Issues tab and include the text.