Format

AMD: require(["esri/widgets/CoordinateConversion/support/Format"], (Format) => { /* code goes here */ });
ESM: import Format from "@arcgis/core/widgets/CoordinateConversion/support/Format";
Class: esri/widgets/CoordinateConversion/support/Format
Inheritance: Format Accessor
Since: ArcGIS API for JavaScript 4.7

The Format class represents one of the formats in the Coordinate Conversion widget. Each format describes how a Point should be transformed into a coordinate for display purposes.

See also

Constructors

new Format(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
ConversionInfo

Contains information that describes how this Format should be converted.

more details
Format
CoordinateSegment[]

A array of Coordinate Segments.

more details
Format
String

A string that serves as a pattern describing how this Format should be displayed.

more details
Format
String

The name of the class.

more details
Accessor
String

The default pattern describing how this Format should be displayed.

more details
Format
String

A string that is used to label this Format in the UI.

more details
Format
String

The name of the coordinate.

more details
Format
SpatialReference

The SpatialReference for this format.

more details
Format
CoordinateConversionViewModel

The view model of the CoordinateConversion widget that is utilizing this format.

more details
Format

Property Details

conversionInfo ConversionInfo

Contains information that describes how this Format should be converted. This property should only be set when creating a custom Format.

Default Value:null
coordinateSegments CoordinateSegment[]

A array of Coordinate Segments. Each segment represents a section of the Format's coordinate.

Default Value:null
currentPattern String

A string that serves as a pattern describing how this Format should be displayed. The pattern should contain all of aliases specified by the Format's coordinateSegments property.

Default Value:null
Example
// Remove the spaces from an mgrs coordinate
let format = coordinateConversionWidget.formats.find(function(format) {
  return format.name === "mgrs";
});

console.log.(format.currentPattern);
// > Z S X Y

format.currentPattern = "ZSXY"
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

defaultPattern String

The default pattern describing how this Format should be displayed. See currentPattern.

Default Value:null
label String
Since: ArcGIS API for JavaScript 4.24

A string that is used to label this Format in the UI. If not set, it will default to name

name String

The name of the coordinate. A CoordinateConversion widget should not contain multiple Formats with the same name.

Default Value:null
spatialReference SpatialReference

The SpatialReference for this format. Coordinates generated for a format will be derived from points in this spatial reference.

The view model of the CoordinateConversion widget that is utilizing this format.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

// Handle gets removed when the object is destroyed.
this.addHandles(handle);
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

hasHandles(groupKey){Boolean}inherited
Since: ArcGIS API for JavaScript 4.25

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited
Since: ArcGIS API for JavaScript 4.25

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Type Definitions

ConversionInfo

This object describes how a Format should be projected and formatted for display. Used to define custom Formats that require custom conversion and/or projection logic.

Properties
convert Function
optional

A function that takes a point and returns a position.

reverseConvert Function
optional

A function that takes a string and returns a Point.

CoordinateSegment

A coordinate segment represents one piece of a coordinate string.

A MGRS coordinate, for example 30UVG898998, is described by four segments:

  1. Alias Z, the gridzone: 30U
  2. Alias S, the 100,000 meter square designator: VG
  3. Alias X, the easting (x coordinate with respect to the 10,000 meter square): 898
  4. Alias Y, the northing (y coordinate with respect to the 10,000 meter square): 998
Properties
alias String

A string that provides the name for this segment of a coordinate string.

description String

A string that describes the role of this segment.

searchPattern RegExp

A regular expression that should extract this segment from the complete coordinate.

Position Object

Describes a point in terms of a location, a Point, and a coordinate, a string.

Properties
location Point

A point geometry representing the location described by the conversion.

coordinate String

A string representing the location.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.