Since Yahoo killed off their Where-On-Earth (WOEID) API service, it hasn't been possible to use it to get WOEID maprefs for certain APIs. Thankfully, some kind soul uploaded it to the Internet Archive.
The contents are five TSV (tab separated value) files, a Readme.txt file, and a license.txt file.
If you want to read them into a SQLite database (and you'll need to set a primary key on each table), do this:
user@host: sqlite3 geoplanet.sqlite
sqlite> .mode tabs
sqlite> PRAGMA foreign_keys=off;
sqlite> CREATE TABLE adjacencies (id INTEGER PRIMARY KEY, Place_WOE_ID TEXT, Place_ISO TEXT, Neighbour_WOE_ID TEXT, Neighbour_ISO TEXT);
sqlite> .import geoplanet_adjacencies_7.10.0.tsv temp_adjacencies
sqlite> INSERT INTO adjacencies(Place_WOE_ID, Place_ISO, Neighbour_WOE_ID, Neighbour_ISO) SELECT Place_WOE_ID, Place_ISO, Neighbour_WOE_ID, Neighbour_ISO from temp_adjacencies;
sqlite> drop table temp_adjacencies;
sqlite> CREATE TABLE admins (id INTEGER PRIMARY KEY, WOE_ID TEXT, iso TEXT, State TEXT, County TEXT, Local_Admin TEXT, Country TEXT, Continent TEXT);
sqlite> .import geoplanet_admins_7.10.0.tsv temp_admins
sqlite> INSERT INTO admins(WOE_ID, iso, State, County, Local_Admin, Country, Continent) SELECT WOE_ID, iso, State, County, Local_Admin, Country, Continent from temp_admins;
sqlite> drop table temp_admins;
sqlite> CREATE TABLE aliases (id INTEGER PRIMARY KEY, WOE_ID TEXT, Name TEXT, Name_Type TEXT, Language Text);
sqlite> .import geoplanet_aliases_7.10.0.tsv temp_aliases
sqlite> INSERT INTO aliases(WOE_ID, Name, Name_Type, Language) SELECT WOE_ID, Name, Name_Type, Language from temp_aliases;
sqlite> DROP TABLE temp_aliases;
sqlite> CREATE TABLE changes (id INTEGER PRIMARY KEY, Woe_id TEXT, Rep_id TEXT, Data_Version TEXT);
sqlite> .import geoplanet_changes_7.10.0.tsv temp_changes
sqlite> INSERT INTO changes (Woe_id, Rep_id, Data_Version) SELECT Woe_id, Rep_id, Data_Version from temp_changes;
sqlite> DROP TABLE temp_changes;
sqlite> CREATE TABLE places (id INTEGER PRIMARY KEY, WOE_ID TEXT, ISO TEXT, Name TEXT, Language TEXT, PlaceType TEXT, Parent_ID TEXT);
sqlite> .import geoplanet_places_7.10.0.tsv temp_places
sqlite> INSERT INTO places (WOE_ID, ISO, Name, Language, PlaceType, Parent_ID) SELECT WOE_ID, ISO, Name, Language, PlaceType, Parent_ID from temp_places;
sqlite> drop table temp_places;
sqlite> PRAGMA foreign_keys=on;
sqlite> .quit
I would also recommend cleaning up after yourself:
user@host: sqlite3 geoplanet.sqlite
sqlite> VACUUM;
sqlite> .quit
The Geoplanet database is licensed by Yahoo! Geoplanet as Creative Commons By Attribution v3.0:
http://creativecommons.org/licenses/by/3.0/us/
A protocol for encoding geographic locations in a way other than latitude/longitude coordinates. Ideal for places that don't have addresses, like when you're hiking or urbex. 6 or 10 character codes. Crisis response applications. Not case sensitive. Generated from lat/long coordinates. The closer two locations are, the more similar the OLCs are. 10 character codes more accurate than 6 character codes. It's possible to drop characters off the end to encode larger areas. Should be compatible with both Google Maps and Open Streetmaps.