API Overview
Discover Ghana with the Ghana API, this API provides endpoints to lookup locations, find facilities and perform geospatial operations such as distance calculation and directions between two locations in Ghana.
Whether you’re a traveller, a business owner, or just someone who wants to explore this beautiful country, our API can provide you with the information and tools you need to make the most of your time in Ghana. So why wait?
/geofy
This endpoint allows you to lookup locations in Ghana by providing an address query parameter. It returns the latitude, longitude and city name of the location.
Request Parameters:
address: The address of the location to lookup.
The response is a JSON object with the following fields:
latitude: The latitude of the location.
longitude: The longitude of the location.
display_name: The name of the city where the location is located.
/facility
This endpoint allows you to get facilities in Ghana like hospital, bank, college, etc. by providing optional query parameters for facility type, region and city. It returns a list of facilities that match the query parameters.
Request Parameters:
type: The type of health facility to lookup. Default is “hospital”.
region: The name of the region to filter facilities by.
city: The name of the city to filter facilities by.
limit: The number of results to return per page. Default is 10.
Response:
Each facility in the results field is a JSON object with the following fields:
amenity: The name of the facility.
display_name: The display name of the facility.
latitude: The latitude of the facility.
longitude: The longitude of the facility.
address: The address of the facility.
village: The village where the facility is located.
suburb: The suburb where the facility is located.
division: The division where the facility is located.
state: The state where the facility is located.
county: The district where the facility is located.
country_code: The country code where the facility is located.
region: The region where the facility is located.
road: The road where the facility is located.
category: The category of the facility.
website: The website of the facility.
/georev
This endpoint allows you to perform reverse geocoding in Ghana by providing query parameters for latitude and longitude. It returns the name of the city where the location is located.
Request Parameters:
lat: The latitude of the location.
lon: The longitude of the location.
Response:
The response is a JSON object containing the reverse geocoding information for the provided latitude and longitude coordinates.
amenity: The name of the facility.
city: The name of the city for the provided coordinates.
region: The name of the region or state for the provided coordinates.
country: The name of the country for the provided coordinates.
type: The type of address of the provided coordinates.
suburb: The name of the suburb for the provided coordinates.
category: The category of the provided coordinates.
boundingbox: The bounding box coordinates of the provided coordinates.
display_name: The complete address for the provided coordinates.
If there is an error, the response will be a JSON object containing the error message.
/distance
This endpoint calculates the distance between two locations based on their latitude and longitude coordinates, while allowing the user to specify the unit of measurement.
Request Parameters:
lat1 (float): latitude of the first location (required)
lon1 (float): longitude of the first location (required)
lat2 (float): latitude of the second location (required)
lon2 (float): longitude of the second location (required)
unit (string, optional): unit of distance measurement, valid options are 'km' (default), 'mi', 'ft', and 'yd'
Response:
If successful, returns a JSON object containing: distance (float): the calculated distance between the two locations unit (string): the unit of measurement used for the distance If unsuccessful, returns a JSON object containing: error (string): the reason for the error HTTP status code: 400 if the unit of measurement is invalid
/directions
This endpoint returns information about the route between two locations in terms of distance, duration, and steps.
Request Parameters:
start_lat: latitude of the starting point (required)
start_lon: longitude of the starting point (required)
end_lat: latitude of the ending point (required)
end_lon: longitude of the ending point (required)
Response:
distance: distance of the route in meters
duration: duration of the route in seconds
steps: a list of dictionaries containing information about each step in the route, including:
distance: distance of the step in meters
duration: duration of the step in seconds
direction: direction of the maneuver in the step
location: latitude and longitude of the maneuver location
instruction: instructions for the maneuver
API Support
If you have any questions or issues with our API, please don’t hesitate to contact us!