Need to plot some points on a world map(gif) based on the longitude and latitude values obtained from database.
I know how to modify the image to plot the points on that. but for plotting the points need x,y cooridnates.
So need to convert the longitde/latitude values to x/y cartesian coordinates. Want to know the proper formula which will do this.
After getting the x,y cartesian coordinates how do i relate it to image's xy values. There seem to be some change in the scale of y values when moved from center to the pole because earth being spherical in shape.
All the above factors is confusing me how to go about it.
Can you throw some light on this.
thanks
mansoor

longitude/latitude to cartesian coordinates (6 messages)
 Posted by: mansoor kp
 Posted on: February 06 2002 03:43 EST
Threaded Messages (6)
 longitude/latitude to cartesian coordinates by tony saunders on February 06 2002 05:51 EST
 longitude/latitude to cartesian coordinates by John Ternent on February 06 2002 10:24 EST
 longitude/latitude to cartesian coordinates by Adam Young on February 06 2002 14:53 EST
 longitude/latitude to cartesian coordinates by mohd shadab on February 06 2002 11:09 EST
 longitude/latitude to cartesian coordinates by Adam Young on February 06 2002 14:53 EST
 longitude/latitude to cartesian coordinates by David Chung on February 07 2002 00:06 EST
 longitude/latitude to cartesian coordinates by mansoor kp on February 07 2002 05:40 EST

longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: tony saunders
 Posted on: February 06 2002 05:51 EST
 in response to mansoor kp
Hi,
I am currently developing lat/lon translations for an online game that uses mercator maps that you can click on.
distances are calculated using rhumb lines and simple spherical trig functions.
contact me if you want more info tony dot saunders at cox dot co dot uk

longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: John Ternent
 Posted on: February 06 2002 10:24 EST
 in response to mansoor kp
Wow, it's been a while since I messed with any of this stuff. For highprecision, you would have to already know what projection your gif image was using. If you use an equaldistance algorithm and try to plot on an equalarea map, you'll get inaccuracies that, as you note, will increase near the polar regions for cylindrical projections. Add to that the fact that there are a number of 'rightappearing' projections, it may be tough to infer the correct projection to use. Mercator is one of the most popular projections, although the last time I wrote a program to do this, I utilized the Robinson projection which is nice because it provides a set of tables that you can interpolate to get the x and y values. So, either find out what projection your map uses, or aggressively search for a gif in a wellknown projection. The formulae are relatively easy to find for a particular projection.
For smallerscale stuff, you might get away with straight conversions by mapping lat degrees to y values and long degrees to x values... for work that doesn't require high precision and only covers a small area (say a US state) below the 60 degree line, a straight conversion seems to work fine.
Caveat: All my work in this was a long time ago as a student. This opinion should not be confused with one from a qualified GIS professional. 
longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: Adam Young
 Posted on: February 06 2002 14:53 EST
 in response to John Ternent
My dad is a sailor and we had a discussion about this.
Most sailing charts are Mercator. What this means is that for the area on the chart, the north south distance has been exagerated so that 1 nautical mile on the east west is the same as one knot on the north south. 1 Knot = (check me on this) circumferance of the earth at the equator/60*360 or one minute. So for a mercator map, if you wanted to plot 30 degrees 2 minutes north, 50 degrees 32 minutes east, you would first find a mercator map that contained that area. Lets assume you find one that covers from 50 to 60 degrees east, and 30 to 40 degrees north, scanned as an image that is 100X100 cm (yes, huge, but it makes the math easy). The point would be x=32cm y=2 from the lower left.
Math was never my strong suit, so I am sure somewhere I switched a North and an X, but this should get across the genereal Idea. 
longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: mohd shadab
 Posted on: February 06 2002 23:09 EST
 in response to Adam Young
well how about the spatial coordinates way of doing things as in oracle 9i and with all its inbuilt functions?Any ideas on that. 
longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: David Chung
 Posted on: February 07 2002 00:06 EST
 in response to mansoor kp
mansoor,
This problem you describe is nontrivial. My father is a professor of geography specializing in cartogtaphy and my training is in mathematics including specialization in geometries.
I assume you do not know the map projection used in your image. Even if you did know the projection to make use of the information you would have to have all of the parameters that go into it in order to map your lat/lon points to x/y.
There is a mechanism called "rubbersheeting" whereby you take the x/y coordinates of several identifiable points on your map (like the Florida Keys or the mouth of the Mississippi). You then mathematically derive a formula to transform these x/y points to the wellknown lat/longs. This gives you a rough formula to do the conversion  a short cut to the projection.
The reference I use for this stuff is: "Map ProjectionsA Working Manual" by John Snyder. This book is a guide to map projections and the underlying mathematics. It was published by the USGS and may be out of print.
A google search for "rubber sheet cartography" yields several possible results.
Good luck.
Dave 
longitude/latitude to cartesian coordinates[ Go to top ]
 Posted by: mansoor kp
 Posted on: February 07 2002 05:40 EST
 in response to mansoor kp
hi all,
thanks for all your valuable feedback
bye
mansoor