The Android API allows for images to be superimposed onto a map. To do so, the developer specifies a set of lat/long coordinates for an "anchor point" within the image, the width (or height) of the image in meters, and "bearing" value by which the image will be rotated before it is superimposed. More info here:
Instead of an anchor point + width + bearing what I have instead is an image and two points of reference inside it, with coordinates for each. So, for example, I might have a 1000 x 1000 pixel image and know that pixel (100,100) corresponds to coordinates (X,Y) and that pixel (600,600) corresponds to (X',Y').
What I'm unclear on is how to correctly calculate the anchor point, bearing and "width" values to plug into the Android maps API such that (100,100) in my image appears at (X,Y) on the map and (600,600) in my image appears at (X',Y') on the map. Found this page:
with info on how to calculate the distance between two points and both starting and ending bearing. Using the distance formula I can calculate the actual physical distance between my two points of reference. Using basic geometry I can calculate the "pixel distance" between the two points in my image. Taken together, this should give me a conversion factor between pixels and meters, so I should be able to calculate the "width" of the image. Is that right?
But any "flat" image is going to be a projection of some sort, though, so I'm worried that this method of computing "width" won't be entirely accurate. If that inaccuracy is small then I can live with it. The actual physical size of the images I'm planning to overlay shouldn't be more than 20 miles x 20 miles max.
Then there's the issue of "bearing". I can compute the forward azimuth between (X,Y) and (X',Y') and I can compute the angle between (100,100) and (600,600) in my image. If I choose (X,Y) as my anchor and then subtract the latter angle from the former angle then that should give me the amount by which my image needs to be rotated before being its superimposed onto the map. Right?
Again, though, I'm worried about curvature issues. Is that a legitimate concern given I'm only talking about (approximately) 20 x 20 mile overlay images?