public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers
MGRS references are sequences of digits and letters like “4Q FJ 12345 67890” (a reference with 1 metre accuracy), optionally written with reduced resolution as in “4Q FJ 123 678” (a reference with 100 metres accuracy). Those references form a hierarchy of 3 location types:
Grid zone designator (example: “4Q”)
└─100 km square identifier (example: “FJ”)
└─Grid coordinate (example: “12345 67890”)
Conversions between MGRS references and spatial coordinates can be performed by the Coder
inner class.
The result of decoding a MGRS reference is an envelope rather than a point, but a representative point can be obtained.
The encoding and decoding processes take in account Norway and Svalbard special cases (they have wider UTM zones for
historical reasons).
MilitaryGridReferenceSystem system = new MilitaryGridReferenceSystem(); MilitaryGridReferenceSystem.Coder coder = system.createCoder(); Location loc = coder.decode("32TNL83"); System.out.println(loc);should display (locale may vary):
┌─────────────────────────────────────────────────────────────────┐ │ Location type: Grid coordinate │ │ Geographic identifier: 32TNL83 │ │ West bound: 580,000 m — 9°57′00″E │ │ Representative value: 585,000 m — 10°00′36″E │ │ East bound: 590,000 m — 10°04′13″E │ │ South bound: 4,530,000 m — 40°54′58″N │ │ Representative value: 4,535,000 m — 40°57′42″N │ │ North bound: 4,540,000 m — 41°00′27″N │ │ Coordinate reference system: WGS 84 / UTM zone 32N │ │ Administrator: North Atlantic Treaty Organization │ └─────────────────────────────────────────────────────────────────┘
Coder
instances performing conversions between references and coordinates
are not thread-safe; it is recommended to create a new Coder
instance for each thread.CommonCRS.universal(double, double)
,
Military Grid Reference System on Wikipedia,
Serialized FormDefined in the sis-referencing-by-identifiers
module
Modifier and Type | Class and Description |
---|---|
class |
MilitaryGridReferenceSystem.Coder
Conversions between direct positions and references in the Military Grid Reference System (MGRS).
|
OVERALL_OWNER_KEY, THEME_KEY
DEPRECATED_KEY, LOCALE_KEY
DOMAIN_OF_VALIDITY_KEY, SCOPE_KEY
ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY
Constructor and Description |
---|
MilitaryGridReferenceSystem()
Creates a new Military Grid Reference System (MGRS) using the default datum.
|
MilitaryGridReferenceSystem(Map<String,?> properties,
CommonCRS datum)
Creates a new Military Grid Reference System (MGRS) using the specified datum.
|
Modifier and Type | Method and Description |
---|---|
MilitaryGridReferenceSystem.Coder |
createCoder()
Returns a new object performing conversions between
DirectPosition and MGRS references. |
computeHashCode, equals, formatTo, getLocationTypes, getOverallOwner, getTheme
getDomainOfValidity, getInterface, getScope
castOrCopy, equals, getAlias, getDescription, getIdentifiers, getName, getRemarks, hashCode, isDeprecated, isHeuristicMatchForName
print, toString, toString, toWKT
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAlias, getIdentifiers, getName, getRemarks, toWKT
public MilitaryGridReferenceSystem()
public MilitaryGridReferenceSystem(Map<String,?> properties, CommonCRS datum)
CommonCRS
are currently supported.properties
- the properties to be given to the reference system.datum
- the datum to which to transform coordinates before formatting the MGRS references,
or null
for inferring the datum from the CRS associated to each coordinate.public MilitaryGridReferenceSystem.Coder createCoder()
DirectPosition
and MGRS references.
The returned object is not thread-safe; a new instance must be created for
each thread, or synchronization must be applied by the caller.DirectPosition
and MGRS references.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.