Closed yholkamp closed 10 years ago
The postal code parsing is a relatively new addition to the library, so it sounds like you have the latest code but not the data it's looking for. The postal_codes table is normally created as part of the populate_database.rb script in load_postal_codes(), and the canonical way to create it would be to re-run that script. This is one of the longest parts of the whole setup process though, so there are a few shortcuts you can use instead.
If you don't care about handling non-US/UK postal codes in your application, you can just create an empty table to remove the errors, by running something like this from a pgsql interactive prompt on the geodict database (copied from the start of load_postal_codes()):
CREATE TABLE postal_codes (
postal_code VARCHAR(64),
region_code VARCHAR(64),
country_code CHAR(2),
lat FLOAT,
lon FLOAT,
last_word VARCHAR(32));
If you want to just load the postal codes, without rebuilding the other data types, grab the latest data from the dstkdata repository (which should end up in ~/sources/dstkdata), comment out all the load_*() calls except load_postal_codes() at the end of populate_database.rb, and then run the script.
Let me know if those help - if not I'm happy to dig in deeper into what's going wrong!
Thanks once again @petewarden. Running the populate_database.rb again indeed solved it. I did have to run a git pull
in the dstkdata
folder though as the postal codes file wasn't there yet, I think that's where it went wrong earlier.
Lately we've been using a lot of internal errors being returned by the DSTK API for a large range of queries, which makes me wonder if we've perhaps misconfigured it somehow. Each of these exceptions boil down to the following:
Our installation has the latest revisions from Git on it. Is there perhaps some way to resolve these
postal_codes
errors?