Link to home
Start Free TrialLog in
Avatar of jsbsudha
jsbsudhaFlag for Germany

asked on

opengl coordinate system

I have some 2D maps in UTM coordinates( I got from Google earth)...How to convert the UTM coordinates into local opengl coordinates  to display the map in my graphics window?

thank you...
Avatar of Infinity08
Infinity08
Flag of Belgium image

Depends what kind of coordinates you are using in your application.
Avatar of jsbsudha

ASKER

for example UTM coordinates  for x and y  for the  2d map is
X = 555737( upper left corner)
y = 555794( lower right corner)

I just want to convert this into local opengl coordinates and sdisplay the map in my graphics window....
1, Is it possible to convert...?
2, my current opengl window  has defined the viewing voulme
glortho(-24,24,-24,24,0.1,1000)...... In that case is there any idea to visualize this map......



Botgh UTM coordinates and opengl coordinates are cartesian coordinates
>> X = 555737( upper left corner)
>> y = 555794( lower right corner)

upper left and lower right corner ? Aren't they the x and y coordinates of one and the same point ? Which UTM zone ?


>> I just want to convert this into local opengl coordinates and sdisplay the map in my graphics window....

I assume that you have the full UTM coordinates of the top left and bottom right ?
You also have the coordinates of the top left and bottom right of the window in your OpenGL application. You just have to map the UTM coordinates on the OpenGL coordinates ...
ASKER CERTIFIED SOLUTION
Avatar of Jose Parrot
Jose Parrot
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Jose parrot
Thak you very much for your reply.....I will try to work on it and come to you again....
jose parrot:
Can you explain me whay UTM coordinates should be converted into Latitude and longitude...
I would simply map them :) Map the top left UTM coordinates onto the top left of your OpenGL window, and the bottom right UTM coordinates onto the bottom right of your OpenGL window.

All other points are interpolated.
jsbsudha:
UTM includes world very precise format, which isn't an exact sphere. Actually the Earth shape is calle geoyd, simplified to ellipsoids for each region. To render in a precise grid, as the pixels grid, the intermediate conversion to Lat/Long corrects the imprecisions in the plane projections. Then to convert to x,y is as simple as the sample code.

If such imprecision isn't relevant to your purposes, if you don't need neither to know the scale, nor the position nor correct distances, then you can work with UTM directly.

In this case you will simply watch images, which will be at unknown scale.
Also, if you don't need maintain the aspect ratio (proportion) then you can simply map the image as suggested by Infinity08, which is, by far, the simplest approach to the question.

Jose