Reputation: 62714
I have an jpg image of 500 x 400 pixels. I know that at the pixel: 20x20, it is of latitude longitude X. I also know that at a second pixel: 400x100 its of latitude loingitude Y. Given that, how can I find out what is the latitude+longitude of the center pixel of the image? I want to know this because I have a photo of a map of an area of those dimensions that I want to display on top of a google map.
Example: Say I have a 500x400 pixel photo of a map of a top down picture of a amusement park. I know Attraction 1 of the amusement park is located at (latitude,longitude) X I know Attraction 2 of the amusement park is located at (latitude,longitude) Y Since I know that... I want to know what the middle latitude longitude is in the center of the image. That way I can "approximately" draw it at the right spot on a google map.
Upvotes: 0
Views: 198
Reputation: 5839
I assume this is the image you're working with and you want the coordinates on the 500x400 image of the center of the box box made by X and Y?
Your variables:
C
= the center -- this is what you're looking to find
X
= the top left of the inner box
20
in your case20
in your caseY
= the bottom right of the inner box
400
in your case100
in your caseThe solution:
Basically, for and
you find the respective centers in the inner box and add the offset the inner box has to the parent box. Does that make sense?
Upvotes: 1
Reputation: 163612
This is not something linear. Unfortunately, you do not have enough information. You need to know the projection and datum of both and make some conversions.
See also: https://en.wikipedia.org/wiki/Map_projection
Upvotes: 0