Class PrecisionScales
java.lang.Object
org.opensextant.extractors.xcoord.PrecisionScales
- Author:
- ubaldino
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double[]
Maximal error in METERS in coordinate with N decimal places; for up to 12 decimal places.static final float
static final float
static final float
static final float
static final float[]
static final float[]
Precision appears in pairs, as we tolerate some typo/errors in MGRs.static final int[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
count_DD_digits
(String lat) Count the number of decimal places in a lat or lon text string.static int
count_DMS_digits
(String lat) Counts all digits in latitude.static String
format
(double f, int digits) This was deemed to be more Java like, however performs 10x slower than format2() -- which unfortunately rounds too early.static GeocoordPrecision
getDDPrecision
(String lat) Return XCoord precision (+/- meters) in latitude.static void
Sets the precision on a decimal degrees matchstatic void
set precision on a DMS text coordinate -- simply if the Match latitude "has seconds" then its precision is seconds, otherwise if it has minutes, then it is precise to +/- 1 minute, etc.static void
static void
static float
UTM_precision
(String utm) For now default UTM precision to +/- 100m
-
Field Details
-
DEFAULT_UNKNOWN_RESOLUTION
public static final float DEFAULT_UNKNOWN_RESOLUTION- See Also:
-
LAT_DEGREE_PRECISION
public static final float LAT_DEGREE_PRECISION- See Also:
-
DD_precision_list
public static final double[] DD_precision_listMaximal error in METERS in coordinate with N decimal places; for up to 12 decimal places. -
DMS_MIN_PREC
public static final float DMS_MIN_PREC- See Also:
-
DMS_SEC_PREC
public static final float DMS_SEC_PREC- See Also:
-
MGRS_precision_list
public static final float[] MGRS_precision_listPrecision appears in pairs, as we tolerate some typo/errors in MGRs. -
MGRS_offset_precision_list
public static final float[] MGRS_offset_precision_list -
MGRS2DEC_digits
public static final int[] MGRS2DEC_digits
-
-
Constructor Details
-
PrecisionScales
public PrecisionScales()
-
-
Method Details
-
setDDPrecision
Sets the precision on a decimal degrees match- Parameters:
m
- given match
-
getDDPrecision
Return XCoord precision (+/- meters) in latitude.- Parameters:
lat
- string representing latitude- Returns:
- precision
-
count_DD_digits
Count the number of decimal places in a lat or lon text string.- Parameters:
lat
- string representing latitude- Returns:
- number of digits in lat, as a proxy for precision
-
count_DMS_digits
Counts all digits in latitude.- Parameters:
lat
- string representing latitude- Returns:
- number of digits in lat as a proxy for precision
-
setDMSPrecision
set precision on a DMS text coordinate -- simply if the Match latitude "has seconds" then its precision is seconds, otherwise if it has minutes, then it is precise to +/- 1 minute, etc. Default precision is half-degree ~ +/- 55KM. Prior implementation was based on digit counting, whereas with decimal degrees you must count digits to infer precision.- Parameters:
m
- DMS match
-
setMGRSPrecision
- Parameters:
m
- MGRS match
-
setUTMPrecision
- Parameters:
m
- UTM match
-
UTM_precision
For now default UTM precision to +/- 100m- Parameters:
utm
- UTM string- Returns:
- precision
-
format
This was deemed to be more Java like, however performs 10x slower than format2() -- which unfortunately rounds too early.- Parameters:
f
- valuedigits
- digits to include in format- Returns:
- formatted value.
-