Detecting the optimal location for hospitals in Bangalore, India


1.1 Background

Bengaluru (also called Bangalore) is the capital of India’s southern Karnataka state. The center of India’s high-tech industry, the city is also known for its parks and nightlife. It is the third-most-populous city in India. Since it is the third most populous city in India, we need to take care of the health of the people who are residing there. There are some startups in Bangalore which are working on health platforms. So, this project will be useful for the stakeholders who is planning to build a hospital in order to improve the health of Bangaloreans

1.2 Problem

When the stakeholder is planning to build a hospital in order to help people in emergency situations, it is better to computer distance between existing hospitals and find the areas with no or less hospitals. So, the purpose of this project is to find some optimal locations for hospitals.

Particularly, we are interested in locations of Bangalore, India and we will focus on the areas with less or no hospitals. We are focussing on areas with no hospitals or having less than 2 hospitals within 1 km and close to city center as possible.

We will use data analysis and clustering algorithm to generate the most optimal neighborhoods based on this criteria and suggest 5 neighbourhoods to the stakeholder as a result


2. 1 Data requirements

Based on definition of our problem, factors that will influence our decision are:

  • number of existing hospitals in the neighborhood
  • distance between hospitals in the neighborhood

We decided to use a regularly spaced grid of locations, centred around the city centre, to define our neighbourhoods.

Following data sources will be needed to extract/generate the required information:

  • centres of candidate areas will be generated algorithmically and approximate addresses of centres of those areas will be obtained using Google Maps API reverse geocoding
  • number of hospitals and their location in every neighbourhood will be obtained using Foursquare API

2. 2 Data collection

Shivaji nagar is the the centre of the Bangalore city and we will get the coordinates of that center location using Google Maps API. We will generate the centre coordinates of other neighbourhoods around the city center using calculations.  Address of those coordinates will be determined using Google Maps API reverse geocoding. All medical related venues in the particular coordinates within specified radius will be gathered using Foursquare API.

In this project. Initially we are considering the radius as 1.2 km and approximately within 24 km from the city center and generated the neighbourhoods based on this radius and distance.

Here is the small sample of generated neighbourhoods along with address which is obtained using Google maps reverse geocoding API

Once we are ready with neighbourhoods, we started collecting hospitals using the location coordinates with the help of FourSquare API.

Now, we have data set which contains list of hospitals in our generated neighbourhoods along with their location details.

2. 3 Data understanding

We map our data to numpy array and then we will try to understand the data which we got from the previous step.  We have got total of 571 venues related to medical.

Here is the small sample of the list of hospitals which we got from the previous step.

We can see the small sample of medical related venues around a particular location.

We calculated the average distance to closest hospital from each area center and it is about 2890m and refer the attached the screenshot below

2. 4 Data Preparation

We will compute the distance of the nearest hospital and count of nearby hospitals since these are major factors for our problem. Please refer the screenshot below for a sample data which has the computed values

We are interested in locations where there is no hospitals or having less than 2 hospitals and here is our number of locations which satisfies our criteria

2. 5 Modelling Algorithm

The following heatmap is showing the possible coordinates where a medical venue can be built satisfying our criteria

We will use the K-means clustering algorithm to cluster the neighbourhoods which have more scope for building hospitals.  The heat map will look the below-attached figure after the neighbourhoods are clustered


We have formed 5 clusters using K-means clustering which in turn we have got the 5 optimal locations for hospitals which satisfies our criteria “Areas having no hospitals or less than 2 hospitals nearby and close to the city center as possible

So, we started with the centre of the city and generated the neighbourhoods. We got the list of hospitals using FourSquare API and find out the locations where building the hospital will really help the people and the stakeholders

Here is our curated list of optimal locations in Bangalore to build a hospital or a medical venue.


The main purpose of this project was to identify Bangalore areas close to centre with the low number of hospitals or no hospitals in order to aid stakeholders in narrowing down the search for the optimal location for a new hospital. The final decision of location will be taken by stakeholders based on their additional needs like the cost of building a hospital in that area, road facilities etc..


  1. FourSquare API
  2. Google maps
  3. Wikipedia page about Bangalore Population

Kayalvizhi Ganesan

Web developer, Blogger, You-tuber and a learner. I am always open up for learning new things and sharing it with people. This Blog is to share the things which I have learnt. My goal is to help TYRO to become a PRO

2 thoughts on “Detecting the optimal location for hospitals in Bangalore, India

  • May 16, 2019 at 1:03 am

    Can I simply say what a reduction to seek out somebody who truly is aware of what theyre talking about on the internet. You undoubtedly know the right way to deliver a difficulty to mild and make it important. Extra folks have to read this and perceive this facet of the story. I cant imagine youre no more well-liked because you undoubtedly have the gift.


Leave a Reply

Your email address will not be published. Required fields are marked *