Tanzania locations, All Regions from Tanzania, with their respective Districts wards & streets.
Very useful for easily implementing Tanzania locations in any application.
What you need before running the code.
-
Install & Start Postgresql Db Service
-
Copy files from location-files to a top level directory
/posts/...
this is necessary for postgresqlCopy
command to function as expected refer to this question. -
Give user
postgres
full permissions to/posts
directory with
sudo chmod -R postgres:postgres /posts
- Create your locations database owned by
postgres
user
createdb --encoding utf8 --password --owner postgres DATABASE_NAME
Option --password
will prompt you to enter password for the Db.
-
Use
psql DATABASE_NAME
to enter into the database. -
Extract everything
-
Create Tables
\i tables_creation.sql
-
Copy regions information to
general table
with\i general.sql
(Don't judge the repetition) -
Extract countries
\i countries.sql
-
Extract all Tanzania locations
\i extract.sql
- Done!
- Locations (Region, District & Wards) need to use a different auto-incrementing ID field and not it's area code.
The area code should stay as is (in it's field), but there should be a different ID field this will help reduce mixing the IDs once we get broader than just one country.
-
This whole process can easily be automated.
-
At least we should start with
general.sql
as I'm really not proud of it. -
API for this will be awesome!
This data was obtained from TCRA POSTCODE LIST we are by no means fully responsible for it's accuracy.
Process of data standardization was the most complicated and I was helped by a few friends whom I promised to credit.
-
Natali Isuja
-
Joe Master
-
Robert Mnama
-
And of course TCRA for publishing this information.