# X, Y to GPS Coords... help a math dummy

**URL:** https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010
**Category:** Uncategorized
**Created:** [April 18, 2006, 1:11pm UTC](https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010 "2006-04-18T13:11:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dragonfly](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dragonfly](https://forum.kirupa.com/u/dragonfly)
#### Post date: [April 18, 2006, 1:11pm UTC](https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010/1 "2006-04-18T13:11:56Z")

</div>

If im not mistaken, if I have a map of say, Wisconsin, and I know what the Latitude coords (degrees, hours, minutes) of the top and bottom of the map, and I know how many pixels tall the map is, then I should be able to convert, with math, degrees:hours:mins to pixels. (same thing with longitude, but lets just focus on one way first)

I would first find out how may hours (minutes would be over kill for my app) there are to a pixel. Thats pretty easy. But this gives me a decimal number. How do i convert a decimal value (like 10.25) back to degrees and hours (in other words, how do i make .25 a “60” based value)?

Ultimately, i want the user to be able to input coords in the form of degrees, hours, mins. Then convert that to X, Y (to place a marker on the map).

Has any one had experience with this or know how to do this? Probably just some easy math…right? :tb:

---

<div class="post-metadata">

### Author: ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)
#### Post date: [April 18, 2006, 1:24pm UTC](https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010/2 "2006-04-18T13:24:14Z")

</div>

From what i now degrees, hours, minutes have this:

60" means 1’ and 60’ means 1\* so if you have 20.90 you have 21\*30’ ( i think it’s ok 🙂 )

U can use:

```auto

Math.round();

```

To transform the 20.90 to 21:) if a number it’s under x.50 it will change to x.00 and if its more then or equals with x.50 it will change to x+1.00

I hope i helped you.

---

<div class="post-metadata">

### Author: ![dragonfly](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dragonfly](https://forum.kirupa.com/u/dragonfly)
#### Post date: [April 18, 2006, 1:41pm UTC](https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010/3 "2006-04-18T13:41:34Z")

</div>

good morning btibia (it’s morning here 🙂 )

Thank you for the reply, but I’m not sure how to follow what you replied with to a solution on my end. I understand Math.round… but i don’t understand how you’re converting a decimal number to degrees:hours:min (and in turn, converting a GPS coordinate into a X, Y position on an arbitrarily scaled map)

---

<div class="post-metadata">

### Author: ![btibia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/btibia/32/1625_2.png) [@btibia](https://forum.kirupa.com/u/btibia)
#### Post date: [April 18, 2006, 2:23pm UTC](https://forum.kirupa.com/t/x-y-to-gps-coords-help-a-math-dummy/186010/4 "2006-04-18T14:23:31Z")

</div>

If you have an Atlas at home 🙂 take a small look, on every map they have a small SCALE. So you need to think like this (just a small exemple):

1degree = 10cm

Then if you have hours,minutes you go down with mm,etc.

And to change from cm to pixels use Adobe Photoshope 🙂

I found that 10cm = 283 pixels

I hope i helped you with something…i like this thread,so we can speak more here, until you finish the problem.

Good mornin!! 🙂
