0

I have a specific task and after doing some research, I feel a little stuck and confused. Here is my point:

  • I have a raster image with known dimensions (800 x 800 px)
  • I know two point inside this image with her pixel AND geographical coordinates eg: (200,200 in pixel represent 20.5,14.57 in geo and 300,300 represent 21.4,16.01) - measured on place with GPS

I need an idea how to calculate X,Y in pixel on other point with geo-coordinates 21.71,15.01

Java Script is my environment.

Cœur
  • 37,241
  • 25
  • 195
  • 267
xentia
  • 405
  • 1
  • 6
  • 18
  • I hope you also know the scale and the projection – Mark Baker Feb 17 '11 at 12:41
  • You need to know the resolution/scale/projection of the image. Without that you dont know the distance per pixel – TurBas Feb 17 '11 at 12:41
  • yes. I can calculate how many pixel represent 1 geo unit. Also - raster image represent a small area - a city or city region - drawed on merchant projection. – xentia Feb 17 '11 at 12:49

2 Answers2

0

You need to know the extent of the image. Then, when you know the image is eg. 20 degrees long, you also know that 800 pixels equal 20 degrees.

Kristian Frost
  • 791
  • 5
  • 21
  • Kristian, you are right. I'll edit my question - my mistake is that i was wrote that i know one point in image, but i know two. From there i can calculate pixel/degree factor, but the problem is that that two point are not the corners of image – xentia Feb 17 '11 at 13:14
0

Before taking care of the programming part, you have to care about transforming the WGS84 coordinate system (used by GPS) into plane grid system coordinates.

That's trigonometry, and depending on the size of the system you will be using, the precision you need, and your location (the earth is not a perfect sphere), you will have to choose a projection, or use an approximation. In France, we generally use the Lambert projection.

Then, using this new local plane grid, you can just scale it to pixels and fill your image.

edit : I found this question on stackoverflow very similar, and the accepted answer is well explained

Community
  • 1
  • 1
Baztoune
  • 1,215
  • 1
  • 16
  • 20