Research on Identifying Strategic locations for Advertising Emergency Response Services of Forbesganj Heart Research Institute (FHRI), Pune.

Client Profile

India’s leading super speciality centre for research and treatment of cardiovascular diseases.

Research Team Members

Decision Problem

Identifying key strategic locations to put up billboards to advertise FHRI’s emergency response numbers & services.

Research Objectives

To segment customers & identify potential business opportunities.

Why we picked Pune?

Client’s Target Segment

Entity List

Results

Map Overview

Clustered Proxies Map

Billboard 1

Billboard 2

Billboard 3

Billboard 4

Inference

R Program Code

1. Map Overview R-Program.

library("RCurl")
library("jsonlite")
library("plotGoogleMaps")
library("geosphere")

key = "AIzaSyAC9fRXK8HIZO5ISi4HRipr0Q7_5dj4tGU"

url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=hospitals+in+pune&types=hospital&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
hospitals = x$results$geometry$location
head(hospitals)

url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=restaurants+in+pune&types=restaurant&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
restaurants = x$results$geometry$location
head(restaurants)

url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=airport+in+pune&types=airport&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
airports = x$results$geometry$location
head(airports)

hospitals$type = "Hospital"
restaurants$type = "Restaurant"
airports$type = "Airport" 

data = rbind(hospitals,restaurants,airports)
dim(data)
write.csv(data,"pune_places.csv", row.names = F)
sample = data

coordinates(sample) <-~ lng +lat # Create cordinates
proj4string(sample) = CRS('+proj=longlat +datum=WGS84') # Add Projections
m<-mcGoogleMaps(sample,zcol = "type", mapTypeId='ROADMAP',legend=TRUE) #Plot on Google maps

2. Distance Matrix R Program.

library("RCurl")
library("jsonlite")
library("plotGoogleMaps")
library("geosphere")
library("ggplot2")
library("plotGoogleMaps")

key = "AIzaSyAC9fRXK8HIZO5ISi4HRipr0Q7_5dj4tGU"

# hospitals
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=hospitals+in+pune&types=hospital&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
hospitals = x$results$geometry$location
head(hospitals)

# restaurants
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=restaurants+in+pune&types=restaurant&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
restaurants = x$results$geometry$location
head(restaurants)

# airport
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=airport+in+pune&types=airport&location=18.520430,73.856744&radius=15000&key=",key)
doc <- getURL(url, ssl.verifyhost = 0L, ssl.verifypeer = 0L)
x <- jsonlite::fromJSON(doc)
airports = x$results$geometry$location
head(airports)

hospitals$type = "Hospital"
restaurants$type = "Restaurant"
airports$type = "Airport" 

sample = hospitals
coordinates(sample) <-~ lng +lat # Create cordinates
proj4string(sample) = CRS('+proj=longlat +datum=WGS84') # Add Projections
# m<-mcGoogleMaps(sample,zcol = "type", mapTypeId='ROADMAP') # Plot on Google maps


# Get the coordinates
p2 = hospitals[,2:1]

# calculate distances
dist_mat = matrix(0,nrow(p2),nrow(p2))

for (i in 1:nrow(p2)){
  for (j in 1:nrow(p2)){
    dist_mat[i,j] = distCosine(p2[i,],p2[j,], r=6378173)/1000    
  }
}

class(dist_mat)
dist_mat[1:10,1:10]
max(dist_mat)

# Create clusters based in distances
fit <- hclust(as.dist(dist_mat), method="ward")
plot(fit) # display dendogram

groups <- cutree(fit, k=10) # cut tree into 10 clusters
# draw dendogram with red borders around the 10 clusters
rect.hclust(fit, k=10, border="red") 

sample = restaurants
coordinates(sample) <-~ lng +lat # Create cordinates
proj4string(sample) = CRS('+proj=longlat +datum=WGS84') # Add Projections
# m<-mcGoogleMaps(sample,zcol = "type", mapTypeId='ROADMAP') # Plot on Google maps


# Get the coordinates
p2 = restaurants[,2:1]

# calculate distances
dist_mat = matrix(0,nrow(p2),nrow(p2))

for (i in 1:nrow(p2)){
  for (j in 1:nrow(p2)){
    dist_mat[i,j] = distCosine(p2[i,],p2[j,], r=6378173)/1000    
  }
}

class(dist_mat)
dist_mat[1:10,1:10]
max(dist_mat)

# Create clusters based in distances
fit <- hclust(as.dist(dist_mat), method="ward")
plot(fit) # display dendogram

groups <- cutree(fit, k=10) # cut tree into 10 clusters
# draw dendogram with red borders around the 10 clusters
rect.hclust(fit, k=10, border="red") 

sample = airports
coordinates(sample) <-~ lng +lat # Create cordinates
proj4string(sample) = CRS('+proj=longlat +datum=WGS84') # Add Projections
# m<-mcGoogleMaps(sample,zcol = "type", mapTypeId='ROADMAP') # Plot on Google maps


# Get the coordinates
p2 = airports[,2:1]

# calculate distances
dist_mat = matrix(0,nrow(p2),nrow(p2))

for (i in 1:nrow(p2)){
  for (j in 1:nrow(p2)){
    dist_mat[i,j] = distCosine(p2[i,],p2[j,], r=6378173)/1000    
  }
}

class(dist_mat)
dist_mat[1:10,1:10]
max(dist_mat)

# Create clusters based in distances
fit <- hclust(as.dist(dist_mat), method="ward")
plot(fit) # display dendogram

groups <- cutree(fit, k=10) # cut tree into 10 clusters
# draw dendogram with red borders around the 10 clusters
rect.hclust(fit, k=10, border="red") 

Logo Copyright(c) 2016 Forbesganj Consulting Services. All rights reserved.