Blog Entries: 8
Recognitions:
Gold Member

## Longitude/Latitude to screen coordinates

 Quote by shlomi i did the #1st image by my self with Gimp (this is the reason it's not 100% equal - i'm a programmer - not a designer !!:)) and what i'm looking for the some math formula that allowed me to generate this image (#1st) automatically based on the data i have on the DB (as you probably understood - the data from the DB is the 2 areas on thew #1st image: red and yellow) this formula should grow/decrease the object dimensions follow by your location: as much as you go to north or south your height will grow and east to west your width will grow.
I'm leaving the mapping stuff out now, the OP has a method in mind so it's futile trying to explain otherwise.

The easiest way to achieve the above, is to lay a grid over your image (using the lat and lon values for x and y). You then have a database of 'what goes where' and so you would query the database for the coordinates (x and y) and what the object is (let's say it's a ball, you could then query another table to retrieve the ball picture - see normalisation if you're unfamiliar, it cuts down redundancy). You then plot them on the grid overlaid on the map.

This can either be dynamically wrapped around the sphere, or easier would be to save it as an image and simply wrap it as is.

 Quote by jarednjames You then plot them on the grid overlaid on the map.
i already have the process against the DB, mean i have an image pattern for each object i have on the DB and i can draw it on the big texture based on the object's coordinate (long, lat).
but after that all of the objects are draw on the big image, i need to distort the image to be like image #1 ( or maybe distort the object before i plot it on the biug image) and this is what i'm looking for: how can i know how much distortion (via transformation) i need to do for object that for instance, located on the equator of for object that located on the north?
 Blog Entries: 8 Recognitions: Gold Member Why do you need to distort it? If you print the images onto the map, and then save that as a new temporary image (so you have a flat map with the objects on it as a picture file), you can simply wrap that directly onto the world with your engine. It will do the distortion for you. It's not the best way to do it, but it's the easieast if you want to check the results.
 as i understanding, the distortion is needed. to show you that - i took the same 2d image like before (2d.png) and i added a non-distorted object on it (the gray one) but i left the distorted one (yellow), now, you can see those objects on the sphere (sphere1.jpg, sphere2.jpg and sphere3.jpg), the distorted (yellow) look realistic but the gray one (that have the same dimensions like the red but another location on the world) not appear realistic, if I'll convert it with the same distortion like the yellow one it'll looks fine. Over the weekend i read a children book (of my little daughters) that explain things about geography and i found an explanation about how create maps based on sphere (see cBookMerkator.jpg) and i found the 'Mercator projection' method, i think this is what i need but i need to find the proper math formula that let me create the distortion function. i found this article on the internet but the answers are costing money :) so i'll keep search. [P.S. sphere1.jpg and cBookMerkator.jpg are attached on the next post] Attached Thumbnails
 attached sphere1.jpg and cBookMerkator.jpg for the previous post Attached Thumbnails
 Blog Entries: 8 Recognitions: Gold Member I don't know what you're going on about. You're not reading anything I've written. I've told you exactly what you need to do. You do not need the above merkator technique - that is for expanding a globe and you are not doing that. For the last time: 1. Plot your objects onto the flat 2D map (the rectangle one you want to wrap). 2. Save that as a temporary image. 3. Wrap it on the globe. 4. The engine will distort the map and the items you marked on it. That's all there is to it.
 OK.. thanks for your patient... i'll try it.