Format

AMD: require(["esri/widgets/CoordinateConversion/support/Format"], (Format) => { /* code goes here */ });
ESM: import Format from "@arcgis/core/widgets/CoordinateConversion/support/Format.js";
Class: esri/widgets/CoordinateConversion/support/Format
Inheritance: Format→Accessor
Since: ArcGIS Maps SDK 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

Format

Constructor
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

Contains information that describes how this Format should be converted.

Format

A array of Coordinate Segments.

Format

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

Format

The name of the class.

Accessor

The default pattern describing how this Format should be displayed.

Format

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

Format

The name of the coordinate.

Format

The SpatialReference for this format.

Format

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

Format

Property Details

conversionInfo

Property
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

Property
coordinateSegments CoordinateSegment[]

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

Default Value:null

currentPattern

Property
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

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

defaultPattern

Property
defaultPattern String

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

Default Value:null

label

Property
label String
Since: ArcGIS Maps SDK for JavaScript 4.24 Format since 4.7, label added at 4.24.

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

name

Property
name String

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

Default Value:null

spatialReference

Property
spatialReference SpatialReference

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

viewModel

Property
viewModel CoordinateConversionViewModel

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.

Accessor

Returns true if a named group of handles exist.

Accessor

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, addHandles added at 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 }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
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

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, hasHandles added at 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

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25 Accessor since 4.0, removeHandles added at 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

Type Definition
ConversionInfo Object

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 ConvertFunction
optional

A function that takes a point and returns a position.

reverseConvert ReverseConvertFunction
optional

A function that takes a string and returns a Point.

ConvertFunction

Type Definition
ConvertFunction(point){Position}

A user-provided function that converts a Point into a Position. This function may be necessary to provide as part of ConversionInfo when creating a custom Format.

Parameter
point Point

A point to be converted.

Returns
Type Description
Position The returned position.

CoordinateSegment

Type Definition
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

Type Definition
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.

ReverseConvertFunction

Type Definition
ReverseConvertFunction(coordinate){Point}

A user-provided function that converts a coordinate string into a Point. This function may be necessary to provide as part of ConversionInfo when creating a custom Format.

Parameter
coordinate String

The string to be reversed.

Returns
Type Description
Point The returned point

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