Skip to content

CoordinateConversionViewModel

ESM: import CoordinateVM from "@arcgis/core/widgets/CoordinateConversion/CoordinateConversionViewModel.js";
CDN: const CoordinateVM = await $arcgis.import("@arcgis/core/widgets/CoordinateConversion/CoordinateConversionViewModel.js");
Class: @arcgis/core/widgets/CoordinateConversion/CoordinateConversionViewModel
Inheritance: CoordinateConversionViewModelAccessor
Since: ArcGIS Maps SDK for JavaScript 4.7

Provides the logic for the CoordinateConversion widget and component.

See also

Constructors

CoordinateConversionViewModel

Constructor
new CoordinateConversionViewModel(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 Watch for changes topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

A Collection containing every Conversion that is currently displaying.

CoordinateConversionViewModel

Describes the location of the coordinates currently displayed as a Point.

CoordinateConversionViewModel

The name of the class.

Accessor

A Collection containing every Format that is capable of displaying.

CoordinateConversionViewModel

This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.

CoordinateConversionViewModel

This symbol is used to visualize the location currently, when capture mode is active.

CoordinateConversionViewModel

Describes the current mode.

CoordinateConversionViewModel

The view model's state.

CoordinateConversionViewModel

If this property is set to true, sessionStorage or localStorage (depending on storageType) will be used to hydrate and persist the CoordinateConversion's state.

CoordinateConversionViewModel

This property determines whether sessionStorage or localStorage will be used to store state.

CoordinateConversionViewModel

A reference to the MapView or SceneView.

CoordinateConversionViewModel

Property Details

conversions

Property
conversions Collection<Conversion>autocast

A Collection containing every Conversion that is currently displaying.

Example
// conversions can be set with an array of strings where each string is a format's name
coordinateConversion.conversions = ["mgrs"];

currentLocation

Property
currentLocation Point |null |undefinedautocast

Describes the location of the coordinates currently displayed as a Point. Setting this property will update all conversions.

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

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

formats

Property
formats Collection<Format>autocast

A Collection containing every Format that is capable of displaying.

The default formats are basemap, dd, ddm, dms, mgrs, usng, utm, and xy.

goToOverride

Property
goToOverride GoToOverride |null |undefined
Since: ArcGIS Maps SDK for JavaScript 4.8 CoordinateConversionViewModel since 4.7, goToOverride added at 4.8.

This function provides the ability to override either the MapView goTo() or SceneView goTo() methods.

See also
Example
// The following snippet uses Search but can be applied to any
// widgets that support the goToOverride property.
search.goToOverride = function(view, goToParams) {
  goToParams.options = {
    duration: updatedDuration
  };
  return view.goTo(goToParams.target, goToParams.options);
};

locationSymbol

Property
locationSymbol SimpleMarkerSymbol |PictureMarkerSymbol |PointSymbol3D |CIMSymbolautocast

This symbol is used to visualize the location currently, when capture mode is active.

mode

Property
mode String

Describes the current mode.

  • While in live mode, updates occur as the cursor moves.
  • While in capture mode, updates occur on mouse click and then display a graphic marking the current location.

Possible Values:"live" |"capture"

Default Value:"live"

state

Property
state Stringreadonly

The view model's state.

Possible Values:"ready" |"loading" |"disabled"

Default Value:"disabled"

storageEnabled

Property
storageEnabled Boolean
Since: ArcGIS Maps SDK for JavaScript 4.20 CoordinateConversionViewModel since 4.7, storageEnabled added at 4.20.

If this property is set to true, sessionStorage or localStorage (depending on storageType) will be used to hydrate and persist the CoordinateConversion's state.

Default Value:true

storageType

Property
storageType String
Since: ArcGIS Maps SDK for JavaScript 4.23 CoordinateConversionViewModel since 4.7, storageType added at 4.23.

This property determines whether sessionStorage or localStorage will be used to store state.

Possible Values:"session" |"local"

Default Value:"session"
See also

view

Property
view MapView |SceneView |null |undefined

A reference to the MapView or SceneView. Set this to link to a specific view.

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
Promise<Position>

Attempt to convert a point into a Position.

CoordinateConversionViewModel
Promise<void>

Goes to a location in the view associated with the view model

CoordinateConversionViewModel

Returns true if a named group of handles exist.

Accessor
void

Pauses the view model's operation.

CoordinateConversionViewModel
Promise<(String|null|undefined)>

Generates a localized coordinate string suitable for display given a Conversion and a Point

CoordinateConversionViewModel

Removes a group of handles owned by the object.

Accessor
void

Resumes the view model's operation.

CoordinateConversionViewModel
Promise<(Point|null|undefined)>

Attempt to convert a string into a Point.

CoordinateConversionViewModel
void

Set the view model's new location to the input Point

CoordinateConversionViewModel
Promise<Conversion[]>

Update the input conversions based on the input point.

CoordinateConversionViewModel

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.

convert

Method
convert(format, point){Promise<Position>}

Attempt to convert a point into a Position.

Parameters
format Format

The format that describes how the point should be converted.

point Point

The point to convert.

Returns
Type Description
Promise<Position> When resolved, returns a Position.

goToLocation

Method
goToLocation(point){Promise<void>}
Since: ArcGIS Maps SDK for JavaScript 4.34 CoordinateConversionViewModel since 4.7, goToLocation added at 4.34.

Goes to a location in the view associated with the view model

Parameter
point Point

The location to go to

Returns
Type Description
Promise<void>
See also

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");
}

pause

Method
pause(){void}
Since: ArcGIS Maps SDK for JavaScript 4.34 CoordinateConversionViewModel since 4.7, pause added at 4.34.

Pauses the view model's operation. See the resume method

Returns
Type Description
void

previewConversion

Method
previewConversion(conversion, location){Promise<(String|null|undefined)>}

Generates a localized coordinate string suitable for display given a Conversion and a Point

Parameters
conversion Conversion

Specifies the format to use to preview

location Point

The position to preview

Returns
Type Description
Promise<(String|null|undefined)>

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");

resume

Method
resume(){void}
Since: ArcGIS Maps SDK for JavaScript 4.34 CoordinateConversionViewModel since 4.7, resume added at 4.34.

Resumes the view model's operation. See the pause method

Returns
Type Description
void

reverseConvert

Method
reverseConvert(coordinate, format){Promise<(Point|null|undefined)>}

Attempt to convert a string into a Point. The format of the string must be specified. A Collection of available formats can be obtained from the formats property.

Parameters
coordinate String

The coordinate string.

format Format

Specifies the format of the input coordinate.

Returns
Type Description
Promise<(Point|null|undefined)> When resolved, returns a Point.

setLocation

Method
setLocation(point){void}
Since: ArcGIS Maps SDK for JavaScript 4.34 CoordinateConversionViewModel since 4.7, setLocation added at 4.34.

Set the view model's new location to the input Point

Parameter
point Point

The point to be set as the new location.

Returns
Type Description
void

updateConversions

Method
updateConversions(conversions, location){Promise<Conversion[]>}

Update the input conversions based on the input point.

Parameters
conversions Conversion[]

An array of Conversions to be updated.

location Point|null|undefined

A point that will be used to update each input conversion.

Returns
Type Description
Promise<Conversion[]> When resolved, returns an array of Conversions with updated Positions.

Type Definitions

Position

Type Definition
Position

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

Properties
location Point|null|undefined

A point geometry representing the location described by the conversion.

coordinate String|null|undefined

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.