There’s no such thing as a perfect solution

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.
Continue reading “There’s no such thing as a perfect solution”

That’s your job, isn’t it?

Our company has a translation group. Normally we send off our properties files, and we get back the versions for the languages we support in this application. Sometimes we get a few questions from the translators, usually just a clarification of how we’re using a term or a request for some context. I send back and answer, and a few days later I get my translation.

I don’t think their Chinese translator quite understands this process though. I got back a list of translator questions from him, and it’s all stuff like “Please confirm this translation of the string ‘Foo Bar'” followed by a string of Chinese characters. Or “Should the word ‘Digest’ be translated or left as English?” I feel like writing back and saying “HOW THE FUCK SHOULD I KNOW? YOU’RE THE ONE WHO CAN SPEAK CHINESE!” But I won’t. Instead I’m writing to his manager to explain that we can’t answer his questions because we don’t speak Chinese, and leaving out the part about how if we did speak Chinese we wouldn’t need them.

Forgot my mind reading device again

You know, if you’re going to send email to a person who runs a mailing list, don’t assume that he only runs one mailing list. Generally the skills for running one list are transferrable to other mailing lists, so the person in question might run more than one. Take me, for instance. I run probably 2 dozen or so lists. Which is why I get so annoyed when I get email like this:

To whom this may concern:

I am from [Clueless Wankertech] Inc. and we have an event coming up that we feel
the members of your mailing list will benefit from. Below is a post
which we are wondering if you could post to your mailing list or allow
us to do this. Thank you for your time and consideration.

The post is as follows:
[etc]

WordPress plugins

Every now and then, the WordPress OpenID comment plugin I use goes mental and starts taking people’s comments and posting them to a non-existant post, and also stripping out all the text of their comments. I suspect it’s an interaction with SpamKarma2 and/or Akismet, but there is no way I’m going to do without spam protection, so I guess at times like this, my only option is to deactivate the OpenID plugin.

So sorry pir and jdev, but your comments were lost. Please feel free to submit them again.

Now I’m even more confused than before

As I wrote in Rants and Revelations » C Paul Program, C Paul Rant, I’m trying to “recreate” a C program that I wrote back in 2001. I’m using the same shapelib library for reading ESRI shape files, I’m using (what I think is) the same algorithm for doing point in polygon tests, and it’s using the same shape file, one that was published on the ESRI web site back when Nunavut first became a territory. And it seems to be up and running.

So I wrote a little perl script that goes through my database and picks out the 3400+ waypoints that are in Canada and which come from DAFIF, and run them through both the old and new program. Both the old and new programs are looking at the same shape file. So you’d expect the exact same results, right? Wrong. There are 309 points that the old program assigns provinces to that the new program says are outside of any provincial boundary. Some of those are ones that I’d already noticed were assigned to provinces even though they were way out at sea and probably shouldn’t be, but some were airports that are near the coast or on islands. That’s a problem.

My first suspicion was that the algorithm as published used floats, but I’d converted it to using doubles because face it, these days computers are so damn fast. But I switched back to floats and now there are 314 differences. Some of the original 309 are now back to what they were, but some points have jumped provinces, like COMPR which moved from Alberta to Saskatchewan (which Google Maps just barely agrees with, by the way) and KITAR which moved from British Columbia to Yukon Territory (which Google Maps says is a toss up). But most importantly, it didn’t “fix” any of the coastal or island airports that ended up with no province. I’m not convinced that’s a net positive. So I’ve gone back to using doubles.

Ok, one other difference is that the notes for the algorithm mentioned a way to compensate for shapes with holes in them by inserting (0.0,0.0) points between the rings. I don’t think I did that before. So I tried without. No dice – still 309 differences.

And then I remembered one other difference. I call SHPRewindObject on each shape as I read it. According to the docs, that’s supposed to fix any problems with shapes that go the wrong way round. But no, that didn’t change anything either.

So I’m left with a mystery about why there is a difference between the old program and the new one. Since I don’t have a GIS program that can read and manipulate shape files, I think my next step will have to be to turn these shape files into Google Maps API polygons so I can plot these wayward points and see if the problem is in the shapes or in the algorithm.