Jump to content
  • Advertisement
Sign in to follow this  
Robinhood

Problem about convertion of coordinate

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to convert longitude and latitude coordinate into a 2D X-Y system. So I need to know how far one coordinate(longitude and latitude sysem) is from another horizontally and vertically.Does anyone kown this?May it be something about Map Making?Any link or articles will be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Think about it terms of mapping one square into another square. That is if you had a point 75% in the x direction on a square and you want it to map to the same relative spot on a square twice as large, how would you do it?

To break it down even further: Think about the problem of mapping a point on a line to the same relative point on another line of a different size

|--*--| <-- length 5, point at 3

Map to this
|----------| <-- length 10, point would be where?

Well, the percentage the point on the first number line is 3/5 or 60%, so on the second number line you would want it to be 60% on that line. or 6/10.

In code:

float perFirstLine = value / lengthFirstLine;
float xLocationSecondLine = perFirstLine * lengthSecondLine;

The same can be applied to the y coordinate.

Share this post


Link to post
Share on other sites
It depends on how the latitude and longitude are constructed. Assuming the map uses a Mercator projection, this might help.

Share this post


Link to post
Share on other sites
Are you referring to the longitude and latitude as locations on Earth ?

Here is what you might find useful:

http://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html

From this site you can find a code to calculate a distance and a direction (in XY-coordinate) between two coordinates presented as longitude and latitude.

With this information, you'll be able to map position to the XY-coordinates.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!