Locations API for Tanzania 🇹🇿

A free, open-source API providing live location data for Tanzania. Use it locally or via our hosted solution.

Explore on GitHub Try the API

About Locations API

The Locations API is an open-source project by HackEAC, designed to provide accurate and up-to-date location data for Tanzania. Whether you're building a mapping app, logistics platform, or need geospatial data, this API has you covered.

Check out the project on GitHub and contribute to its development!

How to Use the Locations API

Option 1: Run Locally

Follow these steps to set up the API on your local machine:

  1. Clone the repository: git clone https://github.com/HackEAC/locations-api.git
  2. Create a .env file and copy variables from sample.env.
  3. Provide PostgreSQL environment variables in the .env file.
  4. Install dependencies: npm install
  5. Run in development mode: npm run start:dev or production mode: npm run start:prod

Use tools like Postman, HTTPie, or curl to test the API locally.

# Example curl request
curl http://localhost:3000/v1/locations
        

Option 2: Use the Hosted API

Access our hosted solution at api.locations.co.tz/v1.

Make HTTP requests to the API endpoint to retrieve location data. No setup required!

# Example curl request to hosted API
curl https://api.locations.co.tz/v1/locations
        

Note: The hosted API is free to use but may have rate limits. Check the documentation for details.

Building Navigation Apps with Locations API

The Locations API makes it easy to build powerful navigation apps by providing accurate, structured location data for Tanzania. Below are three examples demonstrating how the API simplifies location selection compared to manual input.

Example 1: Dynamic Location Selector

Use dropdowns to select a region, district, and ward. The API dynamically loads the correct options, ensuring accuracy.

Example 2: Search-based Location Selection

Search for any location in Tanzania by typing a query (e.g., 'Nzuguni' or 'Dodoma Mahomanyika'). Refine your search by adding more terms.

No localisation selected. Please search and select a location.

Example 3: Manual Location Input

Try typing region, district, and ward names manually. Notice how easy it is to make mistakes or use inconsistent names.

Why Locations API?

Manual input leads to errors like typos or inconsistent names (e.g., "Arusha" vs. "Arusha Region"). The Locations API provides structured, accurate data, ensuring your navigation app delivers reliable results. Whether you're building a ride-sharing app, delivery service, or mapping tool, the Locations API is the key to precise location services.

Explore the GitHub repository or try the hosted API to get started!

Ready to Get Started?

Explore the code, contribute, or start using the API today!

Visit GitHub Repo Try Hosted API