- #1
HSPalm
- 6
- 0
Hi all.
I am doing a programming project where I have a map which is 879x436 pixels. At all endpoints I have the geographical coordinates in latitude and longitude corresponding to 0x0, 0x436, 879x0 and 879x436 pixels endpoints X/Y in all corners. My biggest problem is how to calculate the lat/long from a given pixel coordinate.
Say I need the lat/long from the position (0,218) which is half way down the Y axis on the left. If I just divide the latitude difference from Y=0 to Y=436 by 2 I should have the answer, but the problem is that lat/long coordinates are given by angle.minute.seconds. So I could end up with something like 52deg.80(!)min.XXseconds which is a faulty minute.
Don't mind the Earth beeing an ellipsoid, the map is about 7x7 km so I have chosen to ignore that.
My second problem is that latitude on both edges at X axis do not correspond, same goes for longtitude. This may be my map, because I see that the same problem to not occur in google maps. But never mind that just yet :)
I am very greatfull for any contributions!
I am doing a programming project where I have a map which is 879x436 pixels. At all endpoints I have the geographical coordinates in latitude and longitude corresponding to 0x0, 0x436, 879x0 and 879x436 pixels endpoints X/Y in all corners. My biggest problem is how to calculate the lat/long from a given pixel coordinate.
Say I need the lat/long from the position (0,218) which is half way down the Y axis on the left. If I just divide the latitude difference from Y=0 to Y=436 by 2 I should have the answer, but the problem is that lat/long coordinates are given by angle.minute.seconds. So I could end up with something like 52deg.80(!)min.XXseconds which is a faulty minute.
Don't mind the Earth beeing an ellipsoid, the map is about 7x7 km so I have chosen to ignore that.
My second problem is that latitude on both edges at X axis do not correspond, same goes for longtitude. This may be my map, because I see that the same problem to not occur in google maps. But never mind that just yet :)
I am very greatfull for any contributions!