I’m still trying to find a way to deal with the problem of assigning Canadian waypoints to their correct province. The first thing I did was grab George Plews Airports In Canada data file, which as well as giving me hundreds of new airports that I didn’t have already, also made sure that all my airports were in the right province. But I’ve still got problems.
I’ve already ranted about the different results I get from two programs which are supposed to be doing the same thing (but I lost the source code from one so I can’t tell for sure). Sometimes the new program gives the right result, sometimes the old program gives the right result, sometimes they’re both right and sometimes they’re both wrong. I tried using the debugger to step through the new program with one point in Nunavut that the old program got it right, but the new program said it wasn’t in any province at all. It is actually on the shore of an inlet in one of the Arctic islands. The debugger showed that strictly speaking, the new program is right since the shoreline segment that it should have been inside actually passed a few feet or inches behind it. I wonder if the old program, having been compiled on a 32 bit machine had enough slop that it was on-shore?
So I figured I’d try another tack.
The Geonames server has a web service where you give them a latitude and longitude, and it returns a XML string that has the name of the country and the name of the administrative division. Unfortunately it has problems, too. For instance, most of the points in the North West Territories or Nunavut, it returns an administrative division name of “CA.06”. If it was consistently only doing this to one or the other, that would be ok, but it’s the same results for both. Ok, I thought, at least I could correct the ones that are in the real provinces. And that’s when I noticed this:
The NDB “ZEM” is located at N 52.230661 W 78.517578. If you plot this in Google Maps, you can see quite clearly that it’s in Quebec, but very close to the border with Nunavut. Both my old point in poly program and the new one say it’s in Quebec. But GeoNames returns we are afraid we could not find a administrative country subdivision for latitude and longitude :52.230661,-78.517578
, the same thing it returns when the point is out in the ocean. So in this case, I’d say the point in polygon programs have the edge.
But on the other hand, both point in polygon programs think that the Reporting Point “REFEX” at N 52.701667 W 110 is in Alberta. If you plot that on Google Maps you can see that’s quite clearly in Saskatchewan, and GeoNames agrees. Obviously whoever did the shape file polygons didn’t realize that while the Saskatchewan/Alberta border was meant to be at W 110, they actually surveyed it to whatever accuracy they had back then, and so they missed the 110 degree mark by a bit.
At this point, I’m at a loss for how to resolve the problem. Maybe I should try the new polygon program and the GeoNames server and only change the province if they agree? Or maybe I should just keep looking for better provincial boundary polygons?