Shop OBEX P1 Docs P2 Docs Learn Events
How do I transform GPS Coords on to a cartesian plane. — Parallax Forums

How do I transform GPS Coords on to a cartesian plane.

Naphtali MooreNaphtali Moore Posts: 42
edited 2007-05-04 05:41 in Robotics
Ok, that's not the real question. The real question is: How do I transform GPS Coords on to a cartesian plane. I have an·aerial·photo of Seattle Center. Of course, when its on the screen each pixel corrisponds to a set x,y coord. How would I convert between x,y and longitude, latitude. I'm baisicly looking to write these functions:

char* getLong(int x, int y)
char* getLat(int x, int y)
int getX(char* Longitude, char* Latitude)
int getY(char* Longitude, char* Latitude)

Sure there are obvious things I can do to improve the above code like adding a structure to hold the GPS coords or code to allow for scaling. But, what I need is the math to compisate for the curve of the earth in converting gps to x,y. Any help is appriciated, THANKS! [noparse]:)[/noparse]

Post Edited By Moderator (Chris Savage (Parallax)) : 5/3/2007 10:42:09 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2007-05-03 11:27
    It will all depend on the scale of the image.
    For small areas I don't think the curvature of the earth will factor in very much. Unless you are near the poles.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"

    Benjamin Franklin
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • Naphtali MooreNaphtali Moore Posts: 42
    edited 2007-05-03 11:45
    True, I'm in Seattle, working in an area less than a mile square. BUT I do plan on projects of a larger scope. Latitude is constant at 364584.72 feet per degree. While according to wikipedia.org Longitude is (111.320 + 0.373 Sin(LAT))Cos(LAT) * 3281 feet per degree. You still have to work in direction N/S E/W as positive and negitive values. And at 1 foot = 1 pixel, bingo, you have your coords. From there you can scale it to what you want........................ Assuming Wikipedia is right. Anyone heard anything different.

    In my app I intend to allow the user to load a graphic for the map of the "work area". Then to input the GPS coord of three of the corners and have it set the scale. Hmmmm.... hopefully I can set this up in a week or two. Then to add zoom +/- to the image hehe [noparse]:)[/noparse]
  • crgwbrcrgwbr Posts: 614
    edited 2007-05-03 12:36
    If you are really concerned about it, I'm sure there's some downloadable software that would take an image, and wrap it to the surface of a sphere.

    Craig

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I would love to change the world, but they won't give me the source code

    People say that if you play Microsoft CD's backwards, you hear satanic things, but that's nothing, because if you play them forwards, they install Windows.

    I spent a minute looking at my own code by accident. I was thinking "What the heck is this guy doing?"
  • John AbshierJohn Abshier Posts: 1,116
    edited 2007-05-03 14:34
    If you GPS will output locations in UTM, that is an XY natively.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-05-03 15:14
    Here's a brief reference for the UTM coordinate system: www.maptools.com/UsingUTM/UTMdetails.html. This system works great unless your area of interest spans the "seam" between two or more UTM zones.

    -Phil
  • John AbshierJohn Abshier Posts: 1,116
    edited 2007-05-03 22:56
    When I was in the Army, it seemed that we were always in the "seam". Adds to the fun of manual artillery gunnery.
  • Naphtali MooreNaphtali Moore Posts: 42
    edited 2007-05-04 05:41
    Great! Thanks everybody for your help. I'll look into the leads you have given me and update you from there.! [noparse]:)[/noparse]
Sign In or Register to comment.