Thursday, February 16, 2017

Fighting Eleven #18: Maybe That Is Dallas

As it turns out, mapping longitude and latitude locations using a 2-D map is an interesting problem, so let's discuss it.

I originally thought if I could properly locate the most distant N/S/E/W points properly on the 2-D map, that everyone else would be accurate, but as it turns out, locating those four points accurately is not possible. Part of that is the inherent 3-D/2-D issue, but it is probably also an issue with the map itself--not only is it 2-D, but it's also not entirely correct. Plus, it just shows the United States, so it's only part of a world map.

Here was my original idea: find the furthest points N/S/E/W. Find the range of possible longitude/latitude values. Then, any city in-between should be a percentage of the possible range, right? So I could take the percentage of that range, bang it off the actual run-time dimensions of the map, and Dallas should be Dallas.

Only that isn't working.

I think part of it is not being able to accurately locate the anchor points, but the the other factor is that the further away you are from the anchor points, the more error that's introduced.

So I'm going to try out the "slice" method.

I can manually locate, for example, ten points of latitude and longitude exactly on the map (or as many as I want). Then, I can calculate the position of a city from the closest possible pre-calculated point on the map. So instead of working with a possible distance of 3,000 miles from an anchor point, I'd be working with a maximum distance of 300 instead.

In theory, that should introduce a much smaller amount of error. And I could even make that every 150 miles.

It doesn't need to be perfect. A 15-mile error would be perfectly acceptable, because you wouldn't even notice on the map, given its size.

Except that may not work either.

It's totally possible to manually enter the pixel-perfect location of cities on the map I'm using, then just look up the values, but there are thousands of cities, so that's much more labor intensive than being able to calculate it (if such a thing is possible with a high degree of accuracy).

Onward, into the fog.


Site Meter