[Xastir] Here's a puzzle: Map metadata in map border?

Tom Russo russo at bogodyn.org
Mon Jul 7 18:16:44 EDT 2008


Ok, so I usually run my station with coordinate system UTM, since that's
what I like to use most often.  But sometimes I need to switch to Lat/Lon
in DMS or DDMM.MM format when working with some groups who need things that
way.

I just this moment noticed something truly bizarre about how Xastir displays
the screen extents in its map border (enabled with Map->Enable Map Border and 
Enable Map Grid).

With UTM, the extents appear to be displayed correctly, but with lat/lon
the extents displayed are both (roughly) the coordinates of the lower right 
corner.  See for example these two screen shots, which differ only by the
setting of coordinate system:
 http://www.swcp.com/~russo/imgs/utm.jpg
 http://www.swcp.com/~russo/imgs/ll.jpg

Note that the lat/lon coordinates displayed for upper left corner are the
same as the lat/lon coordinates for the lower right.  That's just plain 
wrong.

What's puzzling, though, is the code for this, in maps.c:

 
        // Put metadata in top border.
        // find location of upper left corner of map, convert to Lat/Long
        convert_lon_l2s(xx2, grid_label1, sizeof(grid_label1), coordinate_format
);
        convert_lat_l2s(yy2, grid_label2, sizeof(grid_label2), coordinate_format
);
        xastir_snprintf(grid_label,
            sizeof(grid_label),
            "%s %s",
            grid_label1,grid_label2);
        // find location of lower right corner of map, convert to Lat/Long
        convert_lon_l2s(xx2, grid_label1, sizeof(grid_label1), coordinate_format
);
        convert_lat_l2s(yy2, grid_label2, sizeof(grid_label2), coordinate_format
);

Note that both sets of "convert_lon_l2s" are working on the same pair of
coordinates, xx2 and yy2, with nothing intervening to change them.  In earlier
code we have:

    // Find xastir coordinates of upper left and lower right corners.
    xx = NW_corner_longitude  + (border_width * scale_x);
    yy = NW_corner_latitude   + (border_width * scale_y);
    xx2 = NW_corner_longitude  + ((screen_width - border_width) * scale_x);
    yy2 = NW_corner_latitude   + ((screen_height - border_width) * scale_y);


It *looks* like the two pairs of convert_lon_l2s should be working on
xx,yy and xx2,yy2 instead, but that doesn't explain at all how the UTM version
of this code actually produces a banner at the top that is correct.  They
should all be wrong.

Can anyone spot what's going on here?

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://kevan.org/brain.cgi?DDTNM
 "It's so simple to be wise: just think of something stupid to say and
  then don't say it."  --- Sam Levinson




More information about the Xastir mailing list