In version 6.00.1300152000 20110314 and later, the
may be used with
<fmt> to print a latitude, longitude or
location (geocode) value, in a manner similar to how date/time values
are printed with
%t. Flags indicate what type of value is
expected, and/or if a subformat is provided:
A latitude argument is expected (memory aid: latitude lines are horizontal, so is minus sign). This is the default.
A longitude is expected (memory aid: longitude lines are vertical; so is pipe).
A location is expected; either a geocode
long value, or a
latitude and longitude (e.g. comma-separated).
%at (date/time format), the next argument (before the
latitude/longitude/location) is a subformat indicating how to
print the latitude and/or longitude. Without this flag,
no subformat argument is expected, and a default subformat is used.
Latitude, longitude and location arguments should be in one of the
formats supported by the
latlon2geocode() (with single arg)
SQL functions, as appropriate. If the
a flag is given, the
subformat string may contain the following codes:
%Hfor the hemisphere letter ("
E" or "
%hfor the hemisphere sign ("
+" or "
%ofor an ISO-8859-1 degree sign
%Ofor a UTF-8 degree sign
%%for a percent sign
A field width, precision, space, zero and/or minus flags may be
given with the
%S codes, with the same
meaning as for numeric
fmt codes. If no flags are given to a
code, the width is set to 2 (or 3 for longitude degrees), with space
padding for degrees and zero padding for minutes and seconds.
Additionally, a single
numeric-type flag may be given with the
codes. This flag will print the value with the corresponding
fmt numeric code, e.g. truncated to an integer for
i, floating-point with potential roundoff for
g. This flag is only valid for the smallest unit
(degrees/minutes/seconds) printed: larger units will always be printed
in integer format. This ensures that a fractional value will not be
printed twice erroneously, e.g. 20.5 degrees will not have its
.5" degrees fractional part printed if "
is also being printed, because the degrees numeric-type will be forced
to integer regardless of flags.
The default numeric-type flag is
g for the smallest unit.
This helps ensure values are printed with the least number of decimal
places needed (often none), yet with more (sub-second) accuracy if
specified in the original value. Additionally, for the
if a degrees/minutes/seconds value is less than
( 10^-(p-2) ), where p is the format code's precision
(default 6), it will be truncated to 0. This helps prevent
exponential-format printing of values, which is often merely an
artifact of floating-point roundoff during unit conversion, and not
part of the original user-specified value.
<!-- Print latitude, default format: -->
<fmt "%-L\n" 41.75>
<!-- Print a longitude in Garmin format: -->
<fmt "%a|L\n" "%H%03D%O%02.2fM'" -121.123>
<!-- Dump geocodes for humans: -->
<sql row "select Geocode from geoTable">
<fmt "Loc: %+L\n" $Geocode>