mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
830 stars 255 forks source link

[Swift] animate(toPosition:, onScreen:, height:, heading:, time:) produces results that are way off the target location #904

Closed jmcazaux closed 7 years ago

jmcazaux commented 7 years ago

When using animate(toPosition:, onScreen:, height:, heading:, time:) I get location way off the actual target.

If I use animate(toPosition:, onScreen:, time:) and then map.heading = heading the map shows the correct location but the visual effect is a bit disturbing (gives you motion sickness ;) )

mousebird commented 7 years ago

What's your test location for this?

jmcazaux commented 7 years ago

This is in South of France. 44°N, 4°E.

You can find a GPX sample here https://s3-eu-west-1.amazonaws.com/static.flightassistant.aero/forum/Montpellier+-+Aubenas.gpx

mousebird commented 7 years ago

Hey @rghosh0, did you put together a GPX reader at one point?

rghosh0 commented 7 years ago

I converted the gpx file to an array and fed it into LocationTrackingSimTestCase in AutoTester, and it seems to work:

https://drive.google.com/file/d/0B9Kv4E5NP1kFVlFLdkpMbmhENkU/view?usp=sharing

simPointData = [[3.955482,43.575934,234.200000],[3.955482,43.575934,0.000000],[3.955482,43.575934,0.000000],[3.955447,43.575963,318.700000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955447,43.575963,0.000000],[3.955315,43.575913,242.600000],[3.955078,43.575753,227.000000],[3.954892,43.575454,204.100000],[3.955328,43.575194,129.400000],[3.956139,43.574801,123.800000],[3.957249,43.574250,124.400000],[3.958453,43.573651,124.500000],[3.959576,43.573088,124.700000],[3.960695,43.572522,124.900000],[3.961901,43.571915,124.800000],[3.962954,43.571444,121.700000],[3.963432,43.571838,41.300000],[3.963539,43.572534,6.300000],[3.963728,43.573571,7.500000],[3.963955,43.574812,7.500000],[3.964208,43.576131,7.900000],[3.964433,43.577376,7.400000],[3.964608,43.578584,6.000000],[3.964701,43.579532,4.100000],[3.963915,43.580000,309.400000],[3.962680,43.580590,303.400000],[3.960275,43.581808,305.000000],[3.959483,43.582257,308.000000],[3.959188,43.582606,328.500000],[3.959323,43.583202,9.400000],[3.959357,43.583261,22.200000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959357,43.583261,0.000000],[3.959499,43.583482,25.000000],[3.959784,43.583975,22.700000],[3.960192,43.583883,107.300000],[3.960408,43.583765,127.000000],[3.962721,43.582598,124.900000],[3.966897,43.580475,125.100000],[3.971554,43.578159,124.500000],[3.976025,43.576115,122.300000],[3.981728,43.574013,117.000000],[3.987663,43.573418,97.900000],[3.991647,43.576247,45.600000],[3.993680,43.579854,22.200000],[3.996010,43.583687,23.800000],[3.999931,43.586345,46.900000],[4.003604,43.588807,47.200000],[4.007400,43.591684,43.700000],[4.010964,43.594801,39.600000],[4.013444,43.597848,30.500000],[4.014791,43.601549,14.800000],[4.015670,43.605362,9.500000],[4.016431,43.608995,8.600000],[4.017441,43.612695,11.200000],[4.018288,43.616425,9.300000],[4.018918,43.621083,5.600000],[4.019351,43.626053,3.600000],[4.019921,43.630782,5.000000],[4.020893,43.635600,8.300000],[4.021993,43.641072,8.300000],[4.022948,43.646075,7.900000],[4.023903,43.651671,7.000000],[4.024794,43.656856,7.100000],[4.025518,43.662558,5.300000],[4.026238,43.667737,5.700000],[4.027407,43.673318,8.600000],[4.028726,43.678418,10.600000],[4.029991,43.684132,9.100000],[4.030935,43.689290,7.500000],[4.031405,43.694708,3.600000],[4.032139,43.699457,6.400000],[4.032883,43.704189,6.500000],[4.033640,43.709036,6.400000],[4.034674,43.714568,7.700000],[4.035695,43.720083,7.600000],[4.036363,43.725167,5.400000],[4.036943,43.730190,4.800000],[4.037834,43.735692,6.700000],[4.038913,43.740637,9.000000],[4.040102,43.745482,10.000000],[4.041434,43.750265,11.400000],[4.042974,43.755400,12.200000],[4.044318,43.760093,11.700000],[4.045666,43.764737,11.800000],[4.047180,43.769833,12.100000],[4.048909,43.774371,15.400000],[4.050946,43.778734,18.600000],[4.053644,43.783522,22.100000],[4.056649,43.788375,24.100000],[4.059232,43.793417,20.300000],[4.061639,43.798471,19.000000],[4.063973,43.802980,20.500000],[4.066487,43.808004,19.900000],[4.068700,43.812672,18.900000],[4.071055,43.817962,17.800000],[4.073125,43.822633,17.700000],[4.075712,43.827730,20.100000],[4.078435,43.832891,20.800000],[4.080914,43.838040,19.200000],[4.082948,43.842893,16.800000],[4.085059,43.847661,17.700000],[4.087415,43.852753,18.500000],[4.089363,43.857366,16.900000],[4.091013,43.862028,14.300000],[4.093180,43.867108,17.100000],[4.095541,43.872166,18.600000],[4.098048,43.877277,19.500000],[4.100594,43.882328,20.000000],[4.103016,43.886886,21.000000],[4.105906,43.891785,23.000000],[4.108633,43.896679,21.900000],[4.111212,43.901555,20.900000],[4.113326,43.906090,18.600000],[4.115710,43.911093,18.900000],[4.117571,43.915719,16.200000],[4.119468,43.920321,16.500000],[4.121590,43.925349,16.900000],[4.123796,43.930324,17.700000],[4.126113,43.935325,18.400000],[4.128038,43.939914,16.800000],[4.130109,43.944919,16.600000],[4.132112,43.949908,16.100000],[4.133609,43.954558,13.000000],[4.135278,43.959749,13.000000],[4.136959,43.965195,12.500000],[4.138477,43.970255,12.200000],[4.140090,43.975963,11.500000],[4.141603,43.981151,11.800000],[4.143442,43.986747,13.300000],[4.145186,43.992340,12.600000],[4.147425,43.997860,16.300000],[4.150199,44.003309,20.100000],[4.152897,44.008716,19.700000],[4.155339,44.013591,19.800000],[4.157773,44.018474,19.700000],[4.160228,44.023406,19.700000],[4.163140,44.028857,21.000000],[4.166070,44.034058,22.000000],[4.168462,44.038742,20.200000],[4.170487,44.043565,16.800000],[4.172475,44.048855,15.100000],[4.174310,44.053744,15.100000],[4.176184,44.059215,13.800000],[4.177754,44.064260,12.600000],[4.179283,44.069384,12.100000],[4.180876,44.074977,11.600000],[4.182508,44.080408,12.200000],[4.184055,44.085692,11.900000],[4.185298,44.090467,10.600000],[4.186775,44.095664,11.500000],[4.188357,44.100845,12.400000],[4.189964,44.105528,13.800000],[4.191869,44.110580,15.100000],[4.193651,44.115277,15.200000],[4.195450,44.120571,13.700000],[4.197112,44.125386,13.900000],[4.198856,44.130740,13.200000],[4.200543,44.135604,14.000000],[4.202224,44.140495,13.900000],[4.204300,44.145820,15.600000],[4.206279,44.151140,14.900000],[4.207947,44.156532,12.500000],[4.209665,44.161877,13.000000],[4.211601,44.167135,14.800000],[4.213660,44.172350,15.800000],[4.215768,44.177534,16.300000],[4.217592,44.182174,15.700000],[4.219521,44.187290,15.100000],[4.221421,44.191942,16.300000],[4.223217,44.196600,15.500000],[4.225120,44.201782,14.800000],[4.226952,44.206947,14.300000],[4.228710,44.211679,14.900000],[4.230824,44.216864,16.300000],[4.233219,44.222000,18.500000],[4.235496,44.226690,19.200000],[4.238083,44.231873,19.700000],[4.240517,44.236589,20.300000],[4.242865,44.241279,19.700000],[4.245427,44.246437,19.600000],[4.248033,44.251636,19.800000],[4.250649,44.256875,19.700000],[4.252878,44.261691,18.300000],[4.255363,44.266931,18.800000],[4.258051,44.272071,20.500000],[4.260762,44.277297,20.400000],[4.263195,44.282463,18.600000],[4.265411,44.287173,18.600000],[4.267928,44.292366,19.100000],[4.270589,44.297631,19.900000],[4.273194,44.302961,19.300000],[4.275333,44.307877,17.300000],[4.277440,44.312909,16.700000],[4.279848,44.318352,17.600000],[4.282648,44.323640,20.700000],[4.285834,44.328775,23.900000],[4.288610,44.333937,21.000000],[4.290685,44.338755,17.100000],[4.292829,44.344129,15.900000],[4.294790,44.349094,15.800000],[4.297111,44.354593,16.800000],[4.299376,44.360118,16.300000],[4.301420,44.365088,16.400000],[4.303441,44.370462,15.000000],[4.305357,44.375360,15.600000],[4.307357,44.380326,16.100000],[4.309446,44.385796,15.300000],[4.311115,44.390781,13.500000],[4.313074,44.396172,14.600000],[4.315477,44.401471,17.900000],[4.317915,44.406713,18.400000],[4.320135,44.411844,17.200000],[4.321885,44.416584,14.800000],[4.323788,44.421901,14.300000],[4.325738,44.427223,14.700000],[4.327457,44.432122,14.100000],[4.329115,44.437076,13.400000],[4.331072,44.442136,15.400000],[4.333339,44.447623,16.400000],[4.335433,44.453043,15.400000],[4.337404,44.457954,16.000000],[4.339510,44.463398,15.400000],[4.341778,44.468905,16.400000],[4.344502,44.474351,19.600000],[4.347343,44.479127,23.000000],[4.350339,44.483786,24.600000],[4.353933,44.488786,27.100000],[4.357104,44.493295,26.600000],[4.359253,44.498200,17.400000],[4.361139,44.503723,13.700000],[4.363035,44.508606,15.500000],[4.365542,44.513763,19.100000],[4.368047,44.518865,19.300000],[4.370476,44.523993,18.700000],[4.373007,44.529282,18.800000],[4.375614,44.533983,21.600000],[4.378689,44.539123,23.100000],[4.382580,44.544310,28.100000],[4.387460,44.547729,45.500000],[4.393750,44.547946,87.200000],[4.398242,44.544329,138.500000],[4.398593,44.539845,176.800000],[4.397899,44.535100,185.900000],[4.397496,44.530299,183.400000],[4.397429,44.526206,180.700000],[4.397803,44.521694,176.600000],[4.398060,44.517938,177.200000],[4.395329,44.515025,213.800000],[4.389616,44.514233,259.000000],[4.384155,44.514380,272.200000],[4.378440,44.515295,282.700000],[4.374241,44.517741,309.200000],[4.371303,44.521187,328.700000],[4.370537,44.524279,350.000000],[4.370509,44.527302,359.600000],[4.370796,44.530723,3.400000],[4.371107,44.533826,4.100000],[4.371428,44.536754,4.500000],[4.371766,44.539926,4.400000],[4.372028,44.542431,4.300000],[4.372156,44.543822,3.800000],[4.372320,44.544342,12.700000],[4.372258,44.544495,343.800000],[4.372137,44.544245,199.100000],[4.372153,44.543690,178.800000],[4.372051,44.542861,185.000000],[4.371966,44.541877,183.500000],[4.371871,44.540725,183.400000],[4.371773,44.539778,184.200000],[4.371346,44.539435,221.600000],[4.370835,44.539471,275.500000],[4.370286,44.539510,275.800000],[4.369484,44.539532,272.300000],[4.368873,44.539532,269.900000],[4.368632,44.539236,210.100000],[4.368379,44.539246,273.300000],[4.368380,44.539257,3.500000],[4.368380,44.539257,0.000000],[4.368380,44.539257,0.000000],[4.368380,44.539257,0.000000]]

mousebird commented 7 years ago

@rghosh0 How did you convert that? Is it something we can add to the library?

@jmcazaux Seems to be working for us. LocationTrackingSimTestCase is in the AutoTester if you'd like to try it.

jmcazaux commented 7 years ago

@mousebird I am at a client's most of tomorrow, so will only report back around COB tomorrow, but will let you know.

You did try that in Swift didn't you ? Or that would not matter ?

mousebird commented 7 years ago

I wondered the same thing. Example's in Swift.

rghosh0 commented 7 years ago

It's a bit hacky. I first used grep and vi to reduce the gpx to one lat,lon pair per line, and then used this python script to calculate a heading and format the results as a swift array:

https://drive.google.com/file/d/0B9Kv4E5NP1kFWHpmb1FsVVJORDA/view?usp=sharing

mousebird commented 7 years ago

Probably not, then. Would be cool to have GPX loading at some point, though.

jmcazaux commented 7 years ago

Gosh! I was not on the last (develop) commit. Something somewhere must have changed since commit 0563e133 as it is now working.

Must write this one on the "How to lose 1/2 a day" hall of fame!

mousebird commented 7 years ago

Hmm, weird. Well glad it's working.