What's the Most Concave State in the U.S.? Using R to Solve a Geography Puzzle
news.rapgenius.com
news.rapgenius.com
Pedantic, I'm sure, but from the title before I clicked on it I was trying to think of the state whose shape might independently be considered the most concave (though that may be much harder to define). This version of concavity depends largely on the shapes of the states around it (e.g. if Nevada split into 6 horizontal states, suddenly California would be the winner).
But I don't really think of Hawaii as "concave". So I'm going to refine my definition to only allow the points to be chosen in connected areas.
Are two areas considered connected if they cross a river, once?
Maybe you'd want to compute the convex hull on a per-connected-component basis, though, to avoid allowing small islands to have undue influence.
Either that, or say that any area of sea within its convex hull gets treated as part of the state's area. This approach differs in that it special-cases sea over other kinds of land.
So...we've got at least 3 ways so far to assign a measure of convexity/concavity to a state, and they give quite different results.
For instance, your method and the method in the comment you responded to both would assign a low concavity to a state that is almost a square, except that the boundary has a high frequency, low amplitude sawtooth pattern imposed on it. Mine would score that has a very high concavity.
http://www.ncbi.nlm.nih.gov/pubmed/7945702
Although I don't have PubMed access so I can't be sure.
This is an interesting problem.
I chose the "random points" method because it seemed easier to me to get an approximate answer for a generic shape rather than try to figure out areas. Lengths didn't occur to me though and seems interesting, although the shape you describe doesn't "feel" concave to me.
I wonder if you could prove this "probability of a random line segment violating convexity" definition equivalent to something given in terms of a ratio of different areas like the area to convex hull area suggestion below.
1. Draw a line segment between two connected points in the state, such that only the endpoints of the line are contained in the state.
2a. Draw a line segment perpendicular to this one, such that one end touches the first line, the other end touches the border of the state, and only one endpoint is contained within the state. The length of the largest such line is the "concavity" of the state.
2b. Alternatively, measure the area contained between line #1 and the state border. The largest such area is the "concavity" of the state.
2c. Alternatively, measure the ratio of the area in #2b to the length of the corresponding line in #1.
That's just the shape of TN's border. It's not a straight line in any coordinate system. (For example, have a look at google maps, which is in geographic. The northern border of the state roughly follows a parallel, but the details are more complicated due to history and local politics.)
I didn't look at the code in detail (and my R is quite rusty), but the fact that he's using the geosphere package suggests that the intersection calculation is being done on a spherical shell, rather than cartesian space.
I bet I could propose a coordinate system in which it was a straight line. ;)
To draw the crossings, however, he needs to pick a projection and project both C and the state boundaries, which I guess is why he included some PROJ.4 calls.
The standard solution for this is to put lots of little points into the state GIS definition, so that the points get transformed correctly. That way short line segments don't differ by more than a few meters. That means you have to watch out for simplified state representations, but not much else, unless you're being a stickler.
To be clear, they mean that you keep going in the same compass direction.
If you kept going in the direction which seemed straight ahead to you there on the ground, then what you'd get (under suitably idealized conditions) is a great circle.
This is complicated slightly when there isn't a unique shortest path between any given two points (e.g. the earth's north and south poles), leading to definitions of strongly convex, convex and weakly convex. See http://en.wikipedia.org/wiki/Geodesic_convexity and the debate at http://en.wikipedia.org/wiki/Talk:Geodesic_convexity#Dispute...
On topic, though, this is pretty cool. Rivers and coastlines seem to be the best way to get appropriately jagged borders. It's interesting to look at states across the map from east to west and see the shapes get simpler and more geometric over time.
Thanks, guys/gals.
http://www.amazon.com/How-States-Their-Shapes-ebook/dp/B001N...
But I can certainly understand some people here may want to draw a line in the sand (to use a metaphor from the linked book's description) to prevent spam.
(http://blog.prettylittlestatemachine.com/blog/2013/02/20/wha...)