https://github.com/engineerdanny/gh-gps-rest-api
A REST API for Ghana GPS addressing built with Django๐๐
https://github.com/engineerdanny/gh-gps-rest-api
api-rest django gh-gps gps python
Last synced: about 1 month ago
JSON representation
A REST API for Ghana GPS addressing built with Django๐๐
- Host: GitHub
- URL: https://github.com/engineerdanny/gh-gps-rest-api
- Owner: EngineerDanny
- License: mit
- Created: 2022-05-03T10:49:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T19:32:31.000Z (about 4 years ago)
- Last Synced: 2025-04-23T17:53:08.361Z (about 1 year ago)
- Topics: api-rest, django, gh-gps, gps, python
- Language: Python
- Homepage: https://gh-gps.herokuapp.com/api
- Size: 65.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# **GH-GPS-DJANGO-REST-API**
*A REST api for Ghana's Global Positioning System (GPS) written with Python Django ๐๐*
## **API Usage**
Get GhanaPostGPS Address from PlaceName or GPSName.
## Request
End Point URL: https://gh-gps.herokuapp.com/api/get-address
Method: POST
Content-Type: application/json
### Payload
#### When using with a PlaceName
```json
{
"name": "KNUST Guesthouse"
}
```
#### When using with a GPSName
```json
{
"name": "AE-0147-4625"
}
```
## Response
1. When Address exists, it returns an address field which contains a list of Addresses
```json
{
"status": "Address found",
"address": [
{
"Place_Name": "KNUST Guesthouse",
"CenterLatitude": "5.5677456",
"CenterLongitude": "-0.1863609",
"Region": "Greater Accra",
"District": "Korley Klote",
"Area": "RINGWAY ESTATES",
"StreetName": "Nuumo Klotey Street",
"GPSName": "GA0315033",
"PostCode": "GA031",
"PlaceName": "KNUST Guesthouse, GA-031-5033, Korley Klote",
"Street": "KNUST Guesthouse, Nuumo Klotey Street"
}
],
"count": 1
}
```
2. No Address was found
```json
{
"status": "No Address found"
}
```
3. Encounter an error
```json
{
"error": "Request is missing name in the body"
}
```
Get GhanaPostGPS Address from Position (Latitude and Longitude)
## Request
End Point URL: https://gh-gps.herokuapp.com/api/get-gps
Method: POST
Content-Type: application/json
### Payload
```json
{
"lat": "6.1250",
"long": "-1.94872"
}
```
## Response
1. When Address exists, it returns an address field which contains a list of Addresses
```json
{
"status": "Address found",
"address": [
{
"GPSName": "AV31641332",
"Region": "Ashanti",
"District": "Amansie Central",
"PostCode": "AV3164",
"NLat": 6.12502457351701,
"SLat": 6.12497965404504,
"WLong": -1.94876026156099,
"Elong": -1.94871534579679,
"Area": ".",
"Street": ".[Unknown Street]",
"PlaceName": ""
}
],
"count": 1
}
```
2. No Address was found
```json
{
"status": "No Address found"
}
```
3. Encounter an error
```json
{
"error": "Request is missing latitude or longitude in the body"
}
```
## **API Local Set-Up**
Technologies
* [Django](https://www.djangoproject.com/): The web framework for perfectionists with deadlines (Django builds better web apps with less code).
* [DRF](www.django-rest-framework.org/): A powerful and flexible toolkit for building Web APIs
Installation
* Make sure you've got [Python](https://www.python.org") installed.
* Install virtualenv globally with:
```bash
$ pip install virtualenv
```
* Clone this repo
```bash
$ git clone https://github.com/EngineerDanny/GH-GPS-REST-API.git
```
* #### Dependencies
1. Cd into your the cloned repo as such:
```bash
$ cd GH-GPS-API
```
2. Create and fire up your virtual environment:
```bash
$ virtualenv venv -p python3
$ source venv/bin/activate
```
3. Install the dependencies needed to run the app:
```bash
$ pip install -r requirements.txt
```
Running
1. Start the server with:
```bash
$ python manage.py runserver
```
2. You can access the local server by using the following ENDPOINTS:
```
http://localhost:8000/api/
http://localhost:8000/api/get-address
http://localhost:8000/api/get-gps
```
## **License**
This project is under license from MIT. For more details, see the LICENSE file.
Made with :heart: by EngineerDanny
ย