# Making a GPS to vector app, how to scale the height?

Hi, I’m making an app for taking a GPX (a list of GPS) coordinates and converting it to a vector that can be read by apple motion, so that I can animate and design my own path.

The altitude is done, and now the path on where is next up.

The vector is done, but I can not figure out how to scale it properly. My map, that has a lat of 46.43, but how to scale this, I now it is suppose to be around 1.5, but how to get to it and how to calculate it…

I read a lot about a Mercator_projection, but how to get this into xojo?

I have the lat and lon, in degrees, so I have the max and min of both lon and lat.

In my head I should be able to get a ratio of the map in a one to one by these numbers. But then I have to scale it even further based on where on the earth I am. So according to wikipedia :

at latitude 30° the scale factor is k = sec 30° = 1.15,

at latitude 45° the scale factor is k = sec 45° = 1.41,

at latitude 60° the scale factor is k = sec 60° = 2,

at latitude 80° the scale factor is k = sec 80° = 5.76,

at latitude 85° the scale factor is k = sec 85° = 11.5

but how can I make a formula to get these values…

any thoughts?

The secant of an angle is the inverse of the cosine, so k = 1/cos(latitude). Take into account Xojo’s cosine works with radians.

Is that what you meant? Otherwise, I didn’t understand your question.

Julen

1 Like

By radians you mean ? Not my strongest area…
But I have the latitude in degrees… only. so a middle point here from the max to min would give me a good point, but from this I would use that altitude and figure out what the scaling should be. Right ?

Radians is another unit for measuring angles: 180 ° = pi radians (where pi equals 3.1415…).

In xojo you should calculate the sec of your latitude as:
K = Sec latitude = 1/cos (latitude*pi/180)

I don’t understand what your problem is, probably becaude I have never worked with GPS data, so I can’t help you further unless you explain the problem in more detail or point me to some reading that would help me understand it.

Julen

Hi Julen, and thanks for trying to help me. The sec, rad etc. I don’t know much about it…

But from the list in the first post, I need to get a coordinate around 60° to give me a plain 2 in scalefactor of y vs x.

I map all the vectors like 1:1 in my map, but since there is happening scaling vertical, I need to stretch the Y accordingly to this formula…

Did you try what I posted above? Any problem with it?

Hi Julen, yes, this looks promising. I just have to try it in my app…

YESSSSS! looks like this will do the trick… Thanks in a millions

1 Like