Converts between points and formatted coordinate notation strings. More...
Import Statement: | import Esri.ArcGISRuntime 100.15 |
Since: | Esri.ArcGISRuntime 100.1 |
Inherits: |
Methods
- Point fromGars(string coordinates, SpatialReference spatialReference, GarsConversionMode garsConversionMode)
- Point fromGeoRef(string coordinates, SpatialReference spatialReference)
- Point fromLatitudeLongitude(string coordinates, SpatialReference spatialReference)
- Point fromMgrs(string coordinates, SpatialReference spatialReference, MgrsConversionMode mgrsConversionMode)
- Point fromUsng(string coordinates, SpatialReference spatialReference)
- Point fromUtm(string coordinates, SpatialReference spatialReference, UtmConversionMode utmConversionMode)
- string toGars(Point point)
- string toGeoRef(Point point, int precision)
- string toLatitudeLongitude(Point point, LatitudeLongitudeFormat format, int decimalPlaces)
- string toMgrs(Point point, MgrsConversionMode mgrsConversionMode, int precision, bool addSpaces)
- string toUsng(Point point, int precision, bool addSpaces)
- string toUtm(Point point, UtmConversionMode utmConversionMode, bool addSpaces)
Detailed Description
Supported notations are:
- Latitude-longitude in degrees.
- Global Area Reference System (GARS).
- World Geographic Reference System (GEOREF).
- Military Grid Reference System (MGRS).
- United States National Grid (USNG).
- Universal Transverse Mercator (UTM).
Method Documentation
Point fromGars(string coordinates, SpatialReference spatialReference, GarsConversionMode garsConversionMode) |
Parses a coordinate in Global Area Reference System (GARS) notation, and returns a Point representing that location.
- coordinates - The GARS notation string for the coordinate.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the GARS coordinate.
- garsConversionMode - Select whether the returned point's location represents the south-west corner of the GARS cell the coordinate lies within, or its center.
GARS notation examples |
---|
354ND |
354ND22 |
Point fromGeoRef(string coordinates, SpatialReference spatialReference) |
Parses a coordinate in World Geographic Reference System (GEOREF) notation, and returns a Point representing that location.
- coordinates - The GEOREF notation string for the coordinate.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the GEOREF coordinate.
Returns a point with the location from the GEOREF string in the spatial reference provided. Returns an empty Point if the input text could not be parsed.
The spatial reference provided must have an ellipsoid and datum matching those used by the source of the GEOREF string. If no spatial reference is provided, it is assumed the GEOREF string is referenced to WGS 84
. The GEOREF string may contain leading and trailing whitespace.
GEOREF notation examples |
---|
MKML5056 |
MKML50285665 |
Point fromLatitudeLongitude(string coordinates, SpatialReference spatialReference) |
Parses a coordinate in latitude-longitude notation, and returns a Point representing that location.
- coordinates - The latitude-longitude notation string for the coordinate. The coordinate may use decimal degrees, degrees and decimal minutes, or degrees-minutes-seconds 'format'.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the latitude-longitude coordinate.
Returns a point with the location from the latitude/longitude string in the spatial reference provided. Returns an empty Point if the input text could not be parsed.
The spatial reference provided must have an ellipsoid and datum matching those used by the source of the latitude-longitude string. If no spatial reference is provided, it is assumed the latitude-longitude coordinates are referenced to WGS 84
.
Supported characters
Symbol | Character | Name | Unicode number | HTML code |
---|---|---|---|---|
Degree | * | Asterisk | U+002A | * |
^ | Circumflex Accent | U+005E | ^ | |
~ | Tilde | U+007E | ~ | |
° | Degree Sign | U+00B0 | ° | |
º | Masculine Ordinal Indicator | U+00BA | º | |
˚ | Ring Above | U+02DA | ˚ | |
⁰ | Superscript Zero | U+2070 | ⁰ | |
Minute | ' | Apostrophe | U+0027 | ' |
᾿ | Right Single Quotation Mark | U+2019 | ᾿ | |
′ | Prime | U+2032 | ′ | |
Second | " | Quotation Mark | U+0022 | " |
˝ | Double Acute Accent | U+02DD | ˝ | |
” | Right Double Quotation Mark | U+201D | ” | |
″ | Double Prime | U+2033 | ″ |
Latitude-longitude notation examples |
---|
55 56 39.123N 003 09 43.034W |
55°56′39″N 3°09′43″W |
55~56.65205', -003~09.71723' |
55.9442008* | -3.1619539* |
Point fromMgrs(string coordinates, SpatialReference spatialReference, MgrsConversionMode mgrsConversionMode) |
Parses a coordinate in Military Grid Reference System (MGRS) notation, and returns a Point representing that location.
- coordinates - The MGRS notation string for the coordinate.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the MGRS coordinate.
- mgrsConversionMode - The mode used by the given MGRS coordinates.
Returns a point with the location from the MGRS string in the spatial reference provided. The spatial reference provided must have an ellipsoid and datum matching those used by the source of the MGRS string. If no spatial reference is provided, it is assumed the MGRS string is referenced to WGS 84
. Returns an empty Point if the input text could not be parsed.
For an explanation of the different modes for interpreting an MGRS notation string, please see Enums.MgrsConversionMode. Note that the choice between zone 01
and 60
has no impact when reading from an MGRS notation string.
The MGRS string can contain leading and trailing whitespace and can have whitespace between the grid zone designator, the 100km square identifier, and the numerical eastings and northings.
MGRS notation examples |
---|
30UVG898998 |
30UVG 89885 99877 |
Point fromUsng(string coordinates, SpatialReference spatialReference) |
Parses a coordinate in United States National Grid (USNG) notation, and returns a Point representing that location.
- coordinates - The USNG notation string for the coordinate.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the USNG coordinate.
Return a point with the location from the USNG string in the spatial reference provided. Returns an empty Point if the input text could not be parsed.
The spatial reference provided must have an ellipsoid and datum matching those used by the source of the USNG string. If no spatial reference is provided and the USNG string is suffixed with "(NAD 27)"
, it is assumed the USNG string is referenced to NAD
27. If no spatial reference is provided and no such suffix exists, it is assumed the USNG string is referenced to WGS 84
.
The USNG string can contain leading and trailing whitespace and can have whitespace between the grid zone designator, the 100km square identifier and the numerical eastings and northings.
USNG notation examples |
---|
13TFJ 23 59 |
13TFJ2374159574 |
Returns an empty Point on error, including when the given string is not valid USNG notation.
Point fromUtm(string coordinates, SpatialReference spatialReference, UtmConversionMode utmConversionMode) |
Parses a coordinate in Universal Transverse Mercator (UTM) notation, and returns a Point representing that location.
- coordinates - The UTM notation string for the coordinate.
- spatialReference - A spatial reference that defines the datum and ellipsoid referenced by the UTM coordinate.
- utmConversionMode - The latitude notation scheme used by the given UTM coordinate, either a latitudinal band, or a hemisphere designator.
Returns a point with the location from the UTM string in the spatial reference provided. Returns an empty Point on error, including when the given string is not valid UTM notation.
The spatial reference provided must have an ellipsoid and datum matching those used by the source of the UTM string. If no spatial reference is provided, it is assumed the UTM string is referenced to WGS 84
.
The UTM string can contain leading and trailing whitespace and can have whitespace between the zone and latitude designator and the numerical eastings and northings.
UTM notation examples |
---|
30U 489885 6199877 |
30U4898856199877 |
30N 489885 6199877 (using N/S indicator) |
489885.32,6199877.36,30U (this form supports sub-meter precision) |
Returns an empty Point on error, including when the given string is not valid UTM notation.
string toGars(Point point) |
Returns a formatted coordinate in Global Area Reference System (GARS) notation representing the given point's location.
- point - The location to be represented in GARS notation. The point must have a spatial reference.
Returns a GARS notation string representing the GARS cell containing the given point. Returns an empty string on error.
string toGeoRef(Point point, int precision) |
Returns a formatted coordinate in World Geographic Reference System (GEOREF) notation representing the given point's location.
- point - The location to be represented in GEOREF notation. The point must have a spatial reference.
- precision - The 'precision' with which to represent the coordinate. The 'precision' should be in the interval [
0
,9
].
Returns A GEOREF notation string representing the position of the given point. Returns an empty string on error.
The 'precision' value controls the number of digits used to represent the fractional part of the coordinate's latitude and longitude, expressed in minutes. For example:
precision | Example output | Angular precision | Approx precision* |
---|---|---|---|
0 | MKML5056 | 1min | 2km |
1 | MKML5056 | 1min | 2km |
2 | MKML5056 | 1min | 2km |
3 | MKML502566 | 0.1min | 200m |
4 | MKML50285665 | 0.01min | 20m |
5 | MKML5028256652 | 0.001min | 2m |
* At the equator to 1 significant figure.
string toLatitudeLongitude(Point point, LatitudeLongitudeFormat format, int decimalPlaces) |
Returns a formatted coordinate in latitude-longitude notation representing the given point's location.
- point - The location to be represented as a formatted latitude-longitude string. The point must have a spatial reference.
- format - The mode to use when formatting the latitude-longitude string.
- decimalPlaces - The number of decimal places to use.
Returns a string representing the latitude-longitude of the given point. Returns an empty string on error.
The latitude-longitude string contains a space separating the latitude from the longitude value, and the characters 'N'
or 'S'
, and 'E'
and 'W'
, to indicate the hemisphere of each value.
The string will also contain spaces separating the components (degrees, minutes, and seconds) of each value. The 'precision' of the output is controlled by both the format and decimalPlaces parameters. For example:
decimalPlaces | Enums.LatitudeLongitudeFormat | Example output | Angular precision | Approx precision* |
---|---|---|---|---|
0 | DecimalDegrees | 056N 0003W | 1deg | 100km |
1 | DecimalDegrees | 55.9N 003.2W | 0.1deg | 10km |
2 | DecimalDegrees | 55.94N 003.16W | 0.01deg | 1km |
3 | DecimalDegrees | 55.944N 003.162W | 0.001deg | 100m |
0 | DegreesDecimalMinutes | 55 057N 003 010W | 1min | 2km |
1 | DegreesDecimalMinutes | 55 56.7N 003 09.7W | 0.1min | 200m |
2 | DegreesDecimalMinutes | 55 56.65N 003 09.72W | 0.01min | 20m |
3 | DegreesDecimalMinutes | 55 56.650N 003 09.717W | 0.001min | 2m |
0 | DegreesMinutesSeconds | 55 56 039N 003 09 043W | 1sec | 30m |
1 | DegreesMinutesSeconds | 55 56 39.1N 003 09 43.0W | 0.1sec | 3m |
2 | DegreesMinutesSeconds | 55 56 39.12N 003 09 43.03W | 0.01sec | 300mm |
3 | DegreesMinutesSeconds | 55 56 39.123N 003 09 43.034W | 0.001sec | 30mm |
* At the equator to 1 significant figure.
Returns an empty string on error.
string toMgrs(Point point, MgrsConversionMode mgrsConversionMode, int precision, bool addSpaces) |
Returns a formatted coordinate in Military Grid Reference System (MGRS) notation representing the given point's location.
- point - The location to be represented in MGRS notation. The point must have a spatial reference.
- mgrsConversionMode - The mode to use for the returned MGRS notation string.
- precision - The 'precision' with which to represent the coordinate. The 'precision' should be in the interval [
0
,8
]. - addSpaces - If
false
, the generated string contains no spaces. Iftrue
, a space separates the grid zone designator, the 100km square identifier, and the numerical easting and northing values.
Returns an MGRS notation string representing the position of the given point. Returns an empty string on error.
For an explanation of the different modes for interpreting an MGRS notation string, please see Enums.MgrsConversionMode. Note that the choice between zone 01
and 60
has an impact only when generating the MGRS notation string for a point with longitude of exactly 180deg
.
The precision value controls the number of digits used to represent each numerical easting and northing value within the MGRS string. For example:
precision | addSpaces | Example output | Approx precision |
---|---|---|---|
0 | false | 30UVG | 100km |
1 | false | 30UVG89 | 10km |
2 | false | 30UVG8999 | 1km |
3 | false | 30UVG898998 | 100m |
4 | false | 30UVG89889988 | 10m |
5 | false | 30UVG8988499881 | 1m |
0 | true | 30U VG | 100km |
1 | true | 30U VG 8 9 | 10km |
2 | true | 30U VG 89 99 | 1km |
3 | true | 30U VG 898 998 | 100m |
4 | true | 30U VG 8988 9988 | 10m |
5 | true | 30U VG 89884 99881 | 1m |
string toUsng(Point point, int precision, bool addSpaces) |
Returns a formatted coordinate in United States National Grid (USNG) notation representing the given point's location.
- point - The coordinate to be represented in MGRS notation. The point must have a spatial reference.
- precision - The 'precision' with which to represent the coordinate. The 'precision' should be in the interval [
0
,8
]. - addSpaces - If
false
, the generated string contains no spaces. Iftrue
, a space separates the grid zone designator, the 100km square identifier, and the numerical easting and northing values.
Returns a USNG notation string representing the position of the given point. Returns an empty string on error.
The precision value controls the number of digits used to represent each numerical easting and northing value within the USNG string. For example:
precision | addSpaces | Example output | Approx precision |
---|---|---|---|
0 | false | 13TFJ | 100km |
1 | false | 13TFJ25 | 10km |
2 | false | 13TFJ2359 | 1km |
3 | false | 13TFJ237595 | 100m |
4 | false | 13TFJ23745951 | 10m |
5 | false | 13TFJ2374359512 | 1m |
0 | true | 13T FJ | 100km |
1 | true | 13T FJ 2 5 | 10km |
2 | true | 13T FJ 23 59 | 1km |
3 | true | 13T FJ 237 595 | 100m |
4 | true | 13T FJ 2374 5951 | 10m |
5 | true | 13T FJ 23743 59512 | 1m |
*4 | false | 13TFJ23795929 (NAD 27) | 10m |
*2 | true | 13T FJ 23 59 (NAD 27) | 1km |
* When the point's spatial reference is based on NAD
27.
string toUtm(Point point, UtmConversionMode utmConversionMode, bool addSpaces) |
Returns a formatted coordinate in Universal Transverse Mercator (UTM) notation representing the given point's location.
- point - The coordinate to be represented in UTM notation. The point must have a spatial reference.
- utmConversionMode - The latitude notation scheme to use in the returned UTM notation string, either a latitudinal band, or a hemisphere designator.
- addSpaces - If
false
, the generated string contains no spaces. Iftrue
, a space separates the UTM zone and latitude designator, and each numerical easting and northing value.
Returns a UTM notation string representing the position of the given point. Returns and empty string on error.
Example output for a point in the southern hemisphere:
Enums.UtmConversionMode | addSpaces | Example output |
---|---|---|
LatitudeBandIndicators | false | 30U4898846199881 |
LatitudeBandIndicators | true | 30U 489884 6199881 |
NorthSouthIndicators | false | 30N4898846199881 |
NorthSouthIndicators | true | 30N 489884 6199881 |