Background: I've been given a task where I have to calculate the minimum bounding circle of Alaska (for the purpose of running a Roeck test). I'm using the Census' state level geometries available here.
The problem: Alaska's minimum bounding circle gets calculated "incorrectly". There is a string of islands located between ~172 and 180 degrees longitude, while the rest of Alaska is from -180 to -129 degrees longitude. This results in my minimum bounding circle covering the whole globe. While it is technically a correct minimum bounding circle of the given points on a euclidean plane, it clearly doesn't represent the true minimum bounding circle of Alaska. (I'm using PostGIS's ST_MinimumBoundingCircle.)
The solution: The way I made it work was to
- convert Alaska to well known text
- subtract 360 from all of the longitudes between 170 and 180 degrees
- Put Alaska back into the database.
(The code will be in an answer.)
This is a dissatisfying solution because it's not generalized (it won't work in all cases), and it seems harder than necessary.
My question: What are the options for dealing with this problem? Has someone written a more intelligent version of the MBC tool that will find the "true" MBC instead of the over-large one? Is there a simpler way to transpose the geometries than transposing individual points?
Best Answer
This is how I solved the problem: