{"id":173,"date":"2007-07-09T08:05:57","date_gmt":"2007-07-09T08:05:57","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=173"},"modified":"2007-08-29T15:45:17","modified_gmt":"2007-08-29T15:45:17","slug":"do-gps-units-spit-out-wacky-coordinates","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=173","title":{"rendered":"Do GPS units spit out wacky coordinates?"},"content":{"rendered":"<p>I&#8217;ve mentioned before that I wrote some <a href=\"http:\/\/dalelane.co.uk\/blog\/?p=159\">simple code to access the GPS device in my phone<\/a> and upload the coordinates to a <a href=\"http:\/\/dalelane.co.uk\/locserv\/currentloc.php?locusername=dalelane&#038;format=gmap\" target=\"_blank\">Google Maps mashup<\/a>.<\/p>\n<p>This is what it was showing when I got home yesterday evening:<\/p>\n<p><a href=\"http:\/\/dalelane.co.uk\/locserv\/recentloc.php?locusername=dalelane&#038;timeperiod=day&#038;format=gmap\"><img decoding=\"async\" src=\"post-images\/070709-screenshot1.jpg\" alt=\"google map showing me somewhere in Kazakhstan\"\/><\/a><\/p>\n<p>Either my <a href=\"http:\/\/twitter.com\/dalelane\/statuses\/139666022\">minibus driving<\/a> was more eventful than I remember and I took a quick detour via Kazakhstan, or there are still a couple of problems with the code&#8230;<\/p>\n<p><!--more-->Even after going back and removing the entry, the map still looked a little wrong:<\/p>\n<p><a href=\"http:\/\/dalelane.co.uk\/locserv\/recentloc.php?locusername=dalelane&#038;timeperiod=day&#038;format=gmap\"><img decoding=\"async\" src=\"post-images\/070709-screenshot2.jpg\" alt=\"google map showing me in the English Channel\"\/><\/a><\/p>\n<p>At least the Kazakhstan update put me on land! \ud83d\ude42<\/p>\n<p><em>Actually, that last one was very nearly accurate&#8230; the longitude value was positive (1.2&#8230;.) when it should have been negative (-1.2&#8230;). <\/em><\/p>\n<p>I don&#8217;t <em>think<\/em> that my code to get values out of the GPS chip is that buggy&#8230; I mean, I&#8217;ve gone back and checked it fairly thoroughly, and I think I&#8217;m doing everything right. But every now and then I get some complete gibberish out of it. <\/p>\n<p>I added a sanity check to the code a couple of weeks ago which discards impossible coordinates (longitude values over 180 or under -180, and latitude values over 90 or under -90) and that protects against most of the incorrect readings. Before that, I would get some very wacky values anywhere between 0 and 500,000! But it still doesn&#8217;t protect against updates which put me in the middle of a sea. \ud83d\ude42<\/p>\n<p>Assuming that I&#8217;m right in saying that my core code getting values out of the GPS device is fairly solid, then I guess the next step is to add something which maintains some sort of rolling average and discards values which are significantly outside of that. Should be simple, but I&#8217;m just surprised that I need to do that&#8230; is that usual?<\/p>\n<p>I&#8217;ve never noticed the other GPS apps (<a href=\"http:\/\/www.tomtom.com\/products\/category.php?ID=2&#038;Lid=1\" Tom Tom Navigator, <a href=\"http:\/\/mobile.search.live.com\/\" target=\"_blank\">Live Search<\/a>) on my phone display such inaccurate coordinates&#8230; I wonder whether this is because they are collecting data from the GPS unit in a more reliable way than I am, or because they also have to do something like the post-coordinate-collection smoothing that I&#8217;m planning on doing?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve mentioned before that I wrote some simple code to access the GPS device in my phone and upload the coordinates to a Google Maps mashup. This is what it was showing when I got home yesterday evening: Either my minibus driving was more eventful than I remember and I took a quick detour via [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}