There could be many possible ways to describe “straightness”. It depends on where you place your focus. So there won't be a single measure to compute, but there might be several, and depending on this, comparisons between cities may disagree as to which city is more straight. Here are some aspects to consider, and how you could quantify them. I'll write this as a set of goals for “straight” layouts, but if you want an “unstraight” city, you can simply negate each goal.
- You want roads to go in straight lines. One way to quantify this would be by curvature, another would be by the range of azimuth directions covered by that path. One problem with this is that you'd have to decide whether two streets meeting at a crossing are considered a single street continuing at an angle, or two distinct streets which end at that crossing. You could go by street names, or you could introduce some threshold in angle difference to consider these the same street, but either approach feels somewhat arbitrary.
- You want streets to intersect at right angles. So for every pair of intersecting streets, compute some measure for the angle between them. You could take the absolute value of the difference between $90°$ and that angle. Or you could take the absolute value of one minus the dot product of the direction vectors, normalized to unit length. Or you could take the absolute value of determinant of these unit length directions. Or you could take the square instead of the absolute value for any of these measures. All these choices influence how you weight small deviations from right angles vs. large ones.
- You probably could combine the previous two points, by finding some functions where lines meeting at a multiple of $90°$ are considered perfectly straight, and you measure the deviation from that. If you want to use this to detect curves in streets between crossings, you might want to approximate streets by a sequence of straight segments, and the placement of the steps between these is again an arbitrary choice.
- You want the grid to be regular. So for three consecutive crossings on a street, you want the distance between the first two to be equal to the distance between the second and third. Or better yet, you want the ration between these distances to be close to one. In an ideal grid, all these ratios would be equal to one, so one possible way to turn this into an error quantity would be taking the logarithms of all these ratios and summing up their absolute values. This has the benefit that the direction doesn't matter, since the absolute value of the logarithm is the same for a ratio and its inverse.
- Perhaps you want your grid to be not only rectangular but square. In that case, you'd do such a length comparison not only for intervals along the same street, but also for the edges of a block of houses enclosed by a bunch of streets.
- When aggregating these different quantities, you might want to introduce weights. Perhaps big roads are more important than small ones. Or perhaps conversely, the many small roads should rigidly follow the pattern while the big roads might deviate from it for historic or geographic or whatever reasons. Perhaps equal distance in subsequent segments becomes less important if the angle at which the segments meet at a crossing increases. That way you wouldn't have a strict cut-off between “same street” and “different street” but instead some fuzzy fading.
- You might combine all these different measures, in some wheighted form. There it might be important to normalize things. So you probably want to describe each individual quantity as a (possibly weighted) average, then give the final number as a linear combination of these. But you don't have to be linear, you could introduce exponents and other functions to reshape distributions.
As you can see, there are a lot of choices to make, a lot of parameters, and no way to say which one is right unless you have a far more specific concept of what exactly you want to measure.
You can simply make some choices up front, and use them to measure cities. Or you could ask a bunch of people to rate the straightness of several pictures of city layouts, and then tune your parameters in an attempt to reproduce the judgment of these test persons. Or you could start with the point you want to make while comparing two given cities, and then tune the parameters so they support your claim. So even though you can use the above to obtain objective measures, the high number of choices can be abused to construct measures which are anything but objective.