Offline City Geocoder: City Name to Coordinates
Pricing
from $0.09 / 1,000 resolved location
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
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
7 days ago
Last modified
Categories
Features
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
| Field | Example | Meaning |
|---|---|---|
query | Austin, TX | Your text |
status | ok | ok, not_found, country_only, region_only or invalid_input. Only ok is charged |
matchedName | Austin | The city that was matched |
countryCode, countryName | US, United States | Country, with the name in the language you choose |
admin1, admin1Code | Texas, TX | First-level region (state, province) |
latitude, longitude | 30.26715, -97.74306 | City coordinates |
population | 974447 | Population from GeoNames |
timezone | America/Chicago | IANA time zone of the city |
geonameId | 4671654 | GeoNames ID, handy for joins |
confidence | high | high, medium or low, depending on how clearly one city wins |
candidates | 6 | How 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
confidenceandalternativeswhen it matters. - A
countryvalue 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 asregion_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 isregion_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
querytext. Other values come back asinvalid_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
countryvalue in the entry, ordefaultCountry, and checkconfidenceandalternatives. 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
SUMMARYrecord (in the key-value store) gives the data source and the time it was built. - Test data: the GeoNames copy in the
geonamescachepackage (MIT), used only in local tests. - Country names: Unicode CLDR, through the
babelpackage.
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.