As you can see in the image embedded in this page, travel from downtown Phoenix to downtown Scottsdale involves several rectangular-like movements. Traveling in a city laid out in a grid is almost never a straight line, and traveling in a city that’s not laid out in a grid is a complete nightmare. Calculating driving distance for an officer to respond to a call has to be done using the “Manhattan” or “Taxicab” distance method. This method assumes that there are no direct routs between points and thus you have to “square off” the distance by using right angles between the points.

This isn’t as hard as it sounds. If you have a set of two Lat-Long coordinates, all you have to do is use an intermediate point with the 1st points Longitude, and the 2nd points latitude, and calculate the distance to that point from the first using your great circle distance function. Then calculate the distance from your intermediate point to your second point, and add the two intermediate distances together.

Using our R function from this post:

https://enholm.net/2017/07/14/crime-analysis-series-calculating-great-circle-distance-two-points-r-using-haversine-formula/

We can calculate the Manhattan distance using this function:

```################################################################################
#manhattan.dist calculates the rectangular travel distance between two points
#by using north-south great circle distance and then east-west great circle distance
#
################################################################################
manhattan.dist<-function(long1, lat1, long2, lat2){
v_dist<-gcd.slc(long1,lat1,long1,lat2)
h_dist<-gcd.slc(long1,lat2, long2, lat2)
v_dist+h_dist
}```