
Category: Rant
Shoulder update
Just got a call from my doctor – the MRI results are in, and I have a small but full thickness tear in my rotator cuff. I suspected it might be the rotator cuff. Now I have to see an orthopod to see if this is going to require surgery or physio or something in between. It sounds stupid, but I’m almost hoping it will be surgery because in my history of pain, physio never fixes anything.
In the mean time, it’s time to dust off my old SafeType keyboard. I hated having to crane around to see the infrequently used non-alpha keys, but being able to type when your arm is in a sling is a major plus when you don’t have sick leave.
The brain is a gate for pain
I was watching “House MD” and Doctor House is trying to live without pain killers for a week, and ends up crushing his hand with a pestle to deal with the pain in his leg. Doctor Wilson just shrugs and says “The brain is a gate for pain” or something like that, explaining that the brain only lets you feel the worst pain of the multiple pains you’re experiencing. I’m only too aware of that, as the constant pain in my knees and hips makes it hard for me to feel other pains until they are so intense as to be dangerous. The three days I spent walking around with a burst appendix which I thought was trapped gas is testimony to that, as is the foot and a half of gangrenous large intestine they removed when I finally went to see somebody about it.
And thus, a new sudden shoulder pain is very worrisome. All too often in the past, the first indication I’ve had of a joint pain is when it’s so bad that it becomes permanent. And of course, every new joint pain is just another one that the doctors shrug and say “I don’t know, maybe you’ve just got bad joints”. I don’t even want to bother seeing a doctor about them any more – they’ll think they know what it is, put me through months of treatment, and when all it does is make it worse, they shrug and go on to somebody they can actually treat.
More geo coding
I got the airport data nailed down, at least all the stuff I need for iPhone CoPilot (which unlike the other databases I provide doesn’t care about communications frequencies or runways). And now I’m looking at “waypoints”, the points in space, sometimes defined by the intersection of a specific radial or bearing from this navigation aid and a specific radial or bearing from that navigation aid, sometimes a distance and radial from one navigation aid, or in the case of GPS instrument approaches and air routes, just points in space.
The difficulty with waypoints is that their definition in the file doesn’t have any sort of location information other than latitude and longitude, which means I have to hit the geonames server for every one (and so far I’ve gone over my hourly limit with them multiple times while testing this code), and that sometimes they, unlike airports, can be out in the middle of the ocean somewhere. So the geonames “countrySubdivision” service just says “I have no idea what country this is in”.
Unfortunately, my code doesn’t like it when a point isn’t in a country. I need to assign every point a 2 letter country code (I use the FIPS 10.4 code instead of ISO-3166-1 because my first world data came from DAFIF, which used FIPS 10.4 and I stuck with it. I’d probably switch to ISO-3166-1 except I have no idea how to do it painlessly.)
In my program to load FAA data, I do some messing around trying to map the country names they use to FIPS 10.4, and sometimes I’ve done some things I’m not proud of, like mapping “French West Indies” to “GP” (the code for Guadeloupe, which is just one of the four territories that make up the French West Indies) or “Trust Territories” to “JQ” (the code for Johnston Atoll) – that one is really dodgy because the “Trust Territories” were broken down into the Republic of the Marshall Islands (“RM”), the Federated States of Micronesia (“FM”), The Commonwealth of the Northern Mariana Islands (“CQ”) and the Republic of Palau (“PS”). Actually if I looked through the FAA data these days, I’d probably find they never use the name “Trust Territories” any more. Another one that comes up is the United States Minor Outlying Islands, which has an ISO-3166-1 code “UM”, but which consists of 9 separate “insular areas” that have their own FIPS 10.4 codes.
So my thought was to ask the geonames “ocean” service what body of water these points is, and then make up a phoney country code for each ocean. Unfortunately there aren’t just a few oceans, there are are dozens of them – everything from the Arabian Sea to the South Pacific Ocean. So many that I can’t come up with semi-mnemonic identifiers for them. So using the fact that FIPS 10.4 codes never start with O or X, I just went though and assigned anything with “Ocean” in the name a code starting with “O” and anything else a code starting with “X”. It sucks, but it will work. Sort of. I hope.
The long term solution is that separate the code I use for iPhone CoPilot further away from the other navaid.com code, and not require a non-null country code in iPhone CoPilot. Also try to migrate to ISO-3166-1 country codes.
More geocoding nonsense
I had to go back to using geonames.org because of the problems I’d already told you about with Google’s geocoder. But geonames.org has a very strange bug. I’d experimented, and found that sometimes it didn’t return anything, especially for something like a point just off-shore of a small island nation. You’re supposed to be able to feed it a “radius” so it can apply some slop, and sure enough, applying a radius of 25 or so made sure that those points were getting a result. But that’s when I discovered that it was returning the wrong result for places like Pelee Island, which as I’m sure you’re all aware is a tiny little island in Lake Ontario that’s part of Ontario, but is actually closer to Ohio. If you asked geonames for the country and subdivision with no radius, it would return Ontario, CA. But if you gave it a radius of 25, it would return Ohio, US. So I’ve got a dilemma – choose too small a radius, and it won’t find anything for some points, but choose too big a radius, and for some points it will return entirely the wrong thing.
So this is what I’m stuck with – I ask geonames for the country and subdivision with a radius of 1. If it doesn’t find anything, it multiplies the radius by 5, sleeps for 250 milliseconds (to be nice to the geonames server) and tries again. So far that finds a result with a radius of 1 749 times, a radius of 5 9 times, and a radius of 25 3 times. It’s not a good thing – obviously it would be better if geonames returned the right thing the first time, but I’ve done a number of spot checks and it seems to be working.