Developing an Internet-based GIS Application to Analyze and Determine Potential Public School Locations in Addis Ababa
Tags: gis, django, python, showdev
Published: 2021-10-30 05:32:58

## Introduction

The Demographic situation of Addis Ababa has changed over the last few decades. There is an ongoing increase in population and many areas, once uninhabitable forests are now suburban residential places. Nevertheless the construction of public schools is not keeping up with the dramatic changes in the city.

Because of the increase in residential areas in the city, new suitable locations for public schools must be determined for construction. Because of the dynamic changes in the city, a tool is required to make the appropriate analysis. Hence, enabling better decisions to be made in the construction of public schools.

## Purpose of the project

The objective of the project is to develop an internet-based tool that identifies suitable public school locations in the city of Addis Ababa, taking to consideration these factors:

1. Availability of transportation from the residential areas to the proposed location
1. Proximity of the proposed location to the residential areas
1. The demography of the residential area for which the public school is to be constructed

### 1. Availability of transportation

The suitability of a site should consider the availability of transportation form the residential area to the proposed site. The application should analyze the availability of transportation and regard a location with no feasible transport access to a residential area as unsuitable.

### 2. Proximity to residential area

Proximity in our case refers to the closeness of a particular location to the residential area. The application should consider a location closer to a residential area as a more suitable location.

### 3. Demography of the residential area

The population of the residential areas should also be considered when proposing new public school locations. The population size and the residential area size should be used as a primary factor to determining a new location.

## Project Scope

The project is focused in analyzing and determining site suitability for the construction of public schools. It is also limited to the city of Addis Ababa. However this restraint is not forcefully enforced. The application is flexible enough to also include residential areas that exist between the borders. The application can also be expanded by including additional data about schools and residential areas, that might come up in the future.

## Data Collection, Compilation and Formatting

The initial data about schools and residential areas was collected from `openstreetmap`. With the help of the `Overpass API`, data from `openstreetmap` was extracted and stored in a PostgreSQL database with a `PostGIS` extension.

Some unnecessary data was also eliminated form the database. Data without names and other missing information were also removed.

## Design and Development of the Application

Spatial information for the application are stored in a PostgreSQL database with a `PostGIS` extension. The `PostGIS` extension allows for spatial data to be stored in a PostgreSQL database. For users to interactively navigate the spatial information and perform analysis on it, `GeoDjango` Server is used. 

`GeoDjango` is a python based web server application, with GIS functionalities. It allows performing spatial analysis against a database and also deploy a web-based user interface.

The diagram below illustrates the basic architecture of a GeoDjango web application:

![Schematic of the GeoDjango architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mepc4ydl0lj3cxb59rzt.png)

The tools provided by the application maybe used by numerous users, but data modifications need to be handled by privileged users only to avoid misrepresentation of facts. The application is designed to allow multiple users to use the analysis tools to get general information about schools
and residential areas and also find suitable locations for school construction.

![Schematic of the application and data flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mitm0aegcjiq9p7acg06.png)


The Illustration above shows the working scheme of the system. The working scheme is as follows:

1. user sends a request, then the request will be sent through the internet to the server
1. on the server, the request will be processed and data is fetched form the database server
1. data from the database will be retrieved and sent to the application server.
1. The application server will then send the processed data to the user

Admins and normal users generally go through the same procedures, the key difference being that admins have the ability to modify stored information on the database server.

The UML design illustrates the interaction between data and other objects that will be implemented into the system.

![UML class diagram of the application](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cuax5eppd5b4wupvwsod.png)

## Functions and features of the Application

The application provides three tools for the analysis of schools. These tools take advantage of basic GIS functionalities to provide useful operations for analysis.

### Distance Analysis

This tool enables users to find schools which are closer to an arbitrary location. This tool primarily uses the Distance function. The Distance function is an abstraction for the distance calculation supported by the backend database. It enables us to find the distance between two geographic fields.

### Schools Visualization

This tool provides a spatial analysis of all schools registered on the database. For this tool the Leaflet mapping library is used. Leaflet is a JavaScript library for creating interactive maps on the front-end. 

Using the spatial data from the database, we are able to dynamically add new data to the map and display it on the web-page.

### Suitable Sites analysis

This tool helps in analyzing if a particular residential area requires a new public school. It gives insightful indications of where to construct a new school. 

In order to determine if a residential area requires a new school, the application has a set of criterion which it checks against. These are the proximity criteria, size criteria and overall criteria

- **Proximity criteria**: checks if there is a school which is only 5 kms away from the residential
area. If there are no schools in a 5 km radius, then it is a fail.
- **Size criteria**: checks if the student demography is proportional to the schools in the residential
area. Population statistics about residential areas are not stored in the database, but are approximated using an algorithm based on a generalized data. Python implementation of the algorithm is as follows:

```python

# area of residential area is square kms
residential_area_sq_km = obj.area.sq_km
# population density in addis ababa is 5165/km2
population = 5165 * residential_area_sq_km
# 43 % of the population is a student
students = population * (43 / 100)
‘’’
one school holds more than 10,000 students
‘no_schools’ varaible gives us the number of schools that need to #
be located in a 5km radius for the # criteria to pass
‘’’
no_schools = math.ceil(students / 10000)
```

- **Overall criteria**: checks if both the size and proximity criterion pass. This determines if a new school needs to be constructed for a residential area.

If a residential area fails the overall criteria, it is an indication that the area is in need of a new public school. The tool also gives an insight of where to construct the new school by creating a 5km buffer form the centroid of the residential area.

## User Interface

The Dashboard
![Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4xcqtd6aqwck0573x5jk.png)

Distance Analysis Form
![Distance Analysis Form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0n1zs1izy3lz1gpqsqi8.png)


Distance Analysis Result
![Distance Analysis Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydanum1kydyldoc5xa0f.png)


Schools Visualization
![Schools Visualization](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1z4lev1vpti0o9nura44.png)


Suitable Site analysis
![Suitable Site analysis](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59qwqynq45slpo838apf.png)

Suitable Site result– new school required
![Suitable Site – new school required](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xbcswp3km6as5ueefu3d.png)

Suitable site result- new school not required
![Suitable site - new school not required](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pq4snehwivfpkapvniak.png)


## Source-code

Check out the source-code on GitHub

{% github eyuelberga/gis-school-analysis-tool  %}