# Restaurants Closer to Columbus’ Population Center are Better

Click to enlarge

Following my last post on Ohio’s population center, I wanted to get a bit more local. My home town of Columbus has a unique population characteristic: the population is almost uniformly dense. Despite this, I know from personal experience that many of the best restaurants are relatively centrally located in the city. To investigate this further, I used the Yelp API to query information about restaurants in the metro area.

Included in the restaurant details, Yelp provides the latitude and longitude of the restaurant. To find the distance from Columbus’ population center, I used Mario Pineda-Krch’s R implementaion of the Spherical Law of Cosines:

```resto<-read.table(".\\data\\restaurants.txt",header=T,sep="\t")
#Exclude restaurants with few ratings
resto<-subset(resto,resto\$reviews>2)

#Arbitrary coordinates the generally bound the Columbus metro area
col<-subset(oh,oh\$y < 40.15 & oh\$y > 39.85 & oh\$x > -83.15 & oh\$x < -82.8)
#Note we don't need to correct for longitude
#convergence for small regions
colsCenter <- c(sum(col\$num * col\$x)/sum(col\$num)
,sum(col\$num * col\$y)/sum(col\$num))

# Calculates the geodesic distance between two points
# specified by radian latitude/longitude using the
# Spherical Law of Cosines (slc)
gcd.slc <- function(long1, lat1, long2, lat2) {
R <- 6371 # Earth mean radius [km]
d <- acos(sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2) * cos(long2-long1)) * R
return(d) # Distance in km
}