I'm developing a solution for my own use. I intend to use it to update paper nautical charts.
The first problem I've run into is error checking about the boundaries of the charts.
I'll input longitude-latitude for each edge of the chart, latitude for the northern and southern boundaries, longitude for the eastern and western boundaries. I'll enter standard longitude-latitude coordinates for the corrections. Then the fun begins.
I've figured out how to convert degrees-minutes-seconds to decimal degrees, so I can compare one coordinate to another. So far so good.
The first problem I have is error checking: I was happily entering charts, one chart per record, and corrections, but none of the coordinates for the corrections themselves were ever showing up on any of the charts. Then I realized that I had reversed the input on most of the charts, and had the southern boundary to the north of the northern boundary, thereby creating a rectangle with no height, that would never contain any of the coordinates of any of the corrections.
So I need to do error checking on the four boundaries of the charts: I need to validate that the northern boundary as input is north of the southern boundary, and the eastern boundary is east of the western boundary. And, I believe, vice-versa. Which is one of my questions.
How much error checking do I need? If I check the southern boundary against the northern boundary, north-south is good. But what happens if I then input the southern boundary first, and the northern boundary second? Will it still validate correctly?
Do I, therefore, need validation on all four of the coordinates, at the time of input?
Then there's Greenwich and the equator. Whoever designed latitude and longitude clearly wasn't thinking of Filemaker input.
At the moment, all of my charts are Puget Sound, and are all, therefore, in the northern hemisphere and west of Greenwich. So checking the direction of a boundary (N,E,S,W) will always resolve to N and W, and then I'll have to move on to checking the decimal degrees for equal-to-or-greater, and so on. I can see that, and I can probably slug my way through the logic for it.
There are, however, charts that span the equator and charts that span the Greenwich meridian. Those seem (to me) that they will resolve themselves simply by comparing the cardinal directions-- an N will always be north of an S coordinate, for example. At Greenwich, an east coordinate will always be to the east of a west coordinate. All good.
Where I'm having trouble is at the 180 degree longitude line. At that line, and on charts that span that line, 179 degrees west longitude is to the east of 179 degrees east longitude. So comparing the cardinal directions yields a result that is exactly wrong, and comparing the coordinates themselves could yield the same number, even though the coordinates are dozens or hundreds of nautical miles apart.
At least a southern latitude is always south of a northern latitudes, and the latitudes never meet.
So, as specific questions:
- Do I need to check each of the four boundaries, or is checking two of them sufficient?
- If I check just two of them, will I catch errors if I happen to reverse the input order?
- How do I check for input errors in the boundaries of a chart that spans the 180 degree longitude line?