[PATCH] Add GPS locations to some of the test dives

Henrik Brautaset Aronsen subsurface at henrik.synth.no
Sun Jan 13 09:42:44 PST 2013


Henrik Brautaset Aronsen wrote:
> subsurface at henrik.synth.no wrote:
>> From: Henrik Brautaset Aronsen<subsurface at henrik.synth.no>
>>
>> With Pierre-Yves' commit with a map widget, here are a couple of example
>> GPS locations from my own dives.
>
> This also shows a slight problem with the map, as the positions seems 
> to be slightly wrong.  E.g. dive10.xml is at "63.01043, 7.31243", 
> which is here: http://goo.gl/maps/AwWf1.  The Subsurface map puts the 
> position about 22km further south/west.

I found the problem.  We lost precision by dividing a double by an int.  
Fix:

diff --git a/gps.c b/gps.c
index e70c719..768f2d6 100644
--- a/gps.c
+++ b/gps.c
@@ -64,8 +64,8 @@ void show_gps_locations()
                 dp = dive_table.dives[idx];
                 //printf("%s - %u,%u\n", dp->location, 
dp->latitude.udeg, dp->longitude.udeg);
                 if (dp->latitude.udeg != 0 && dp->longitude.udeg != 0){
-                       add_gps_point(map, dp->latitude.udeg / 1000000,
-                               dp->longitude.udeg / 1000000);
+                       add_gps_point(map, dp->latitude.udeg / 1000000.0,
+                               dp->longitude.udeg / 1000000.0);
                 }
         }
         osm_gps_map_set_center_and_zoom(map, 0, 0, 0);

Henrik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130113/509eb5bc/attachment.html>


More information about the subsurface mailing list