Working with GPS coordinates in max
Bit stuck on something I thought was small but am now begining to think is very big (reading this http://cycling74.com/forums/topic.php?id=24639 has simply confused me). I’m download some GPS coordinates from a txt file online, storing in jit.textfile and then pulling out via jit.str.tosymbol. Nothing complex so far but my numbers get chopped after 6 decimal places. How do I get around this as obviously the end of the GPS coordinates are important for precision?
Thanks in advance
----------begin_max5_patcher---------- 729.3ocyW1sbhBCEG+Z7oHCW2hlvWZup6ywNcbBRplNPBaHLZ2N8ceSN.qst JhqVny3PjCgj+mebNmj71DG2D4NVoK5AzOQNNuMwwALYM3zbuiaNc2pLZIzM WAaqL4E26pejlsSClKTbgt05yRgtj+al8IK7l0XUTkKqzYLMLPsVKn5Ua3h0 KUrU5ZgfmGYdIjevbaCAthi8lgdp4c3ovbZzw8webNEzbXNc+ghSyb2OubQ6 zhs1dexD6k65qKWkmvTWhyQZrVaR+ZAq1ybAHgbSnh0t+0cNBBHQAfu6GZaB m0EBhFBDbpu5rBlHEkwErKgO3Swmy.EfCjP6vhpIzofB1e7nxKbsWoV4okku lmHytIQN1vlNoCdNDq3igjmnNyZBFO3nQYnUYLp5lQk5QqSzP7AZLK11DD0Y 1T33wFZAjMkS0J9tu97oVrDAMwclOE4O9UYRkaEYRZ5PPFL.Cenfy7EcRlQL Ypjkgv2jDIXEoyVhI.RfHA.V7IchExEhExsCKJi6w9uBWthxuMrg.rItyxuj 3wcwoprzLzilrJoReiheLC6x15VmM4ptRScZUbmUiIyGWRYu4YdFC8HMkVXf k4OUZIrjykQN+9QtKhi906Ott7TfeWfLbw..xjJsVJburBwmcuvM9YX8oAl0 d8ndYzMyWxYkkz0r+IpXiVW7vzoa2t0iV9qJph4IUqmxE2WnjqUl2ZJuXiTv lZbkMKSoZZBsjMkLCiM+H3EXeBwSuSOXKvOOttbMr+Pb3IPW7UTuFFPW6o.N 3rjfnfSG7IRWJqTqZcglMjh1KqTVolKnZtIXZeeh+Te1vSSYhOdRxbdZgzb. qFIfd5ne06qhrILlz8tkTvfJI6YZNKk.cObZJpGR5.c+kKo9fI6BKColB6gl hF1vov39novgkS8oPPzvFOcPnx2hzNPSmq5DYXqXZ2w+2NN0qXbxvl20mZlg Wy2NyMuO4Of3+Ww2 -----------end_max5_patcher-----------
The main point to take from the thread you cited is this: floats in Max are 32-bit values.
32-bit floating point means a mantissa of effectively 24 bits, or about six digits accuracy. Period.
How to get around this? Well, if you need to work with numerical values, you don’t. If you don’t need arithmetic calculations, you can probably whip something up with jit.str.regexp that will convert the individual GPS coordinates into Max symbols.
It’s hard to say more without knowing what you’re trying to achieve.
Thanks for clarifying that in max directly its just not possible and giving ways forward. I’m using the coordinates to move something in a 3d space so I’ll be mapped the GPS to that. I’m not working quite with -1.0 to 1.0 coordinate system it’s more like -100 to 100 but the suggestion in that other thread of multipling it up (it looks like I’ll need 100000 but I need to check the GPS spec to see how far after the decimal place is something like tens of metres) is possible.
so something like:
51.48642623333333 * 100000 = 5148642.623333333
everything left of 42 can be dumped
might be useful. I had a tough time dealing with this in a project for astronomical positioning where more than 6 places was needed (storing them in [text] and/or [coll]). This took some experimenting to get to…
I think you’ll need to utilize [tosymbol] and [fromsymbol] somewhere. I can’t recall whether this approach actually worked in the end. Possibly it was just to format for another program like Excel, in which case it wouldn’t help (32-bit limit as mentioned…)
Aren’t there 64-bit externals for high precision available? Or maybe you can use a float64 matrix for storing and manipulation.