JimuMapView

Class

JimuMapView is the view for developers to develop the map-related functions. For example, developers can use the view property of the JimuMapView instance to get the original ArcGIS Maps SDK for JavaScript View , then use the original view to develop the map-related functions. At the same time, JimuMapView also provides properties such as isActive and status to indicate the current status in the map widget.

JimuMapView is a wrapper class for the ArcGIS Maps SDK for JavaScript View . It is created by a map widget using a map DataSource .

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { JimuMapView } from 'jimu-arcgis';

// Add the State interface
interface State {
extent: __esri.Extent
}

// On an active view change, set the extent State property
onActiveViewChange = (jimuMapView: JimuMapView) => {
if(!this.extentWatch){
 this.extentWatch = jimuMapView.view.watch('extent', extent => {
   this.setState({
     extent
   })
 });
}
}

// Use the `JimuMapView` instance from the map widget through the `JimuMapViewComponent` React component
<JimuMapViewComponent useMapWidgetId={this.props.useMapWidgetIds[0]} onActiveViewChange={this.onActiveViewChange}></JimuMapViewComponent>

Properties

PropertyTypeNotes
string

The id of the DataSource selected to create the map.

string

The id of the JimuMapView instance.

boolean

The isActive property indicates whether the map in the map widget is accessible. For example, for a single-source map, there is a single JimuMapView instance, therefore, the isActive is always true. With a multi-source map, there are two JimuMapView instances. In the multi-source map, the property isActive is true for the top JimuMapView instance, and false for the one beneath. Upon clicking the switch map tool, the isActive properties will switch.

JimuLayerViews

The union for all JimuLayerView instances and the layer view object wrapper. the JimuLayerView instance in this object may not been loaded. Please call whenJimuLayerViewLoaded() to wait for it's loaded.

The created map tools (ArcGIS JavaScript API widgets) for this view.

string

The id of the widget creating the JimuMapView instance.

The status of the JimuMapView instance. JimuMapViewStatus enumeration members include "LOADING" , "LOADED" and "FAILED" .

MapView | SceneView

The view is the ArcGIS Maps SDK for JavaScript View , including a MapView or a SceneView . In the ArcGIS Maps SDK for JavaScript, the MapView and SceneView are part of the __esri namespace types. Thus, their types are __esri.MapView and __esri.SceneView .

dataSourceId

Class Property
dataSourceId: string

The id of the DataSource selected to create the map.

id

Class Property
id: string

The id of the JimuMapView instance.

isActive

optional
Class Property
isActive: boolean

The isActive property indicates whether the map in the map widget is accessible. For example, for a single-source map, there is a single JimuMapView instance, therefore, the isActive is always true. With a multi-source map, there are two JimuMapView instances. In the multi-source map, the property isActive is true for the top JimuMapView instance, and false for the one beneath. Upon clicking the switch map tool, the isActive properties will switch.

jimuLayerViews

optional
Class Property
jimuLayerViews: JimuLayerViews

The union for all JimuLayerView instances and the layer view object wrapper. the JimuLayerView instance in this object may not been loaded. Please call whenJimuLayerViewLoaded() to wait for it's loaded.

jimuMapTools

Class Property
jimuMapTools: JimuMapTool[]

The created map tools (ArcGIS JavaScript API widgets) for this view.

mapWidgetId

Class Property
mapWidgetId: string

The id of the widget creating the JimuMapView instance.

status

Class Property
status: JimuMapViewStatus

The status of the JimuMapView instance. JimuMapViewStatus enumeration members include "LOADING" , "LOADED" and "FAILED" .

view

Class Property
view: MapView | SceneView

The view is the ArcGIS Maps SDK for JavaScript View , including a MapView or a SceneView . In the ArcGIS Maps SDK for JavaScript, the MapView and SceneView are part of the __esri namespace types. Thus, their types are __esri.MapView and __esri.SceneView .

Methods

MethodReturnsNotes
void

The listener will be triggered when JimuLayerView is created and ready to use.

void

The listener will be triggered when JimuLayerView is removed from JimuMapView.

void

The listener will be triggered when JimuLayerView visibility is changed.

addLayerAndCreateJimuLayerView(layer, dataSource)
Promise<JimuLayerView>

Add layer into map and create JimuLayerView for it. The dataSource is the related data source of the layer. In most cases, layer is created by dataSource.createJSAPILayerByDataSource() method.

void

Clear the selected features.

createJimuLayerView(layerOrSubLayer, parentJimuLayerId, index, runtimeAddedDataSource?, fromRuntime?)
Promise<JimuLayerView>

Create the JimuLayerView and add it into the jimuLayerViews object. Resolve the promise when it is ready.

void

Destroy the JimuMapView instance and the ArcGIS Maps SDK for JavaScript View at the same time.

getAllChildJimuLayerViews(jimuLayerViewId)

Return all child JimuLayerViews.

Return all JimuLayerViews.

getChildJimuLayerViewIds(jimuLayerViewId)
string[]

Return the direct child JimuLayerView ids.

getChildJimuLayerViews(jimuLayerViewId)

Return the direct child JimuLayerViews.

getDataSourceIdByAPILayer(layerOrSubLayer)
string

Get dataSourceId by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Get JimuLayerView by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Get JimuLayerView by dataSourceId.

string

Get jimuLayerViewId by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Get the map data source bound to JimuMapView.

getParentJimuLayerViews(jimuLayerViewId)

Return all parent JimuLayerViews.

Promise<Graphic[]>

Get all selected features in the map.

boolean

Indicates if the JimuMapView is destroyed or not. Returns true if the view is not created or if the view is destroyed, otherwise returns false.

removeJimuLayerView(jimuLayerView)
void

Remove jimuLayerView from jimuMapView and destroy the jimuLayerView. Note, this method will also remove all the children jimuLayerViews.

void

Remove the JimuLayerViewCreatedListener.

void

Remove the JimuLayerViewRemovedListener.

void

Remove the JimuLayerViewsVisibleChangedListener.

removeLayerFromMap(targetLayerId)
void
selectFeaturesByGraphic(graphic, spatialRelationship, selectionMode, options?)
Promise<{}>

Select features in all layers in the map by a graphic.

Promise<JimuLayerViews>

return the loaded JimuLayerViews only

whenJimuLayerViewLoaded(jimuLayerViewId)
Promise<JimuLayerView>

Return the JimuLayerView when it's loaded.

Promise<JimuLayerView>
Promise<JimuMapView>

Resolve the JimuMapView when it is loaded.

addJimuLayerViewCreatedListener

Class Method
addJimuLayerViewCreatedListener(listenerJimuLayerViewCreatedListener): void

The listener will be triggered when JimuLayerView is created and ready to use.

Parameters
ParameterType
listener
JimuLayerViewCreatedListener
Returns 
void

addJimuLayerViewRemovedListener

Class Method
addJimuLayerViewRemovedListener(listenerJimuLayerViewRemovedListener): void

The listener will be triggered when JimuLayerView is removed from JimuMapView.

Parameters
ParameterType
listener
JimuLayerViewRemovedListener
Returns 
void

addJimuLayerViewsVisibleChangeListener

Class Method
addJimuLayerViewsVisibleChangeListener(listenerJimuLayerViewsVisibleChangedListener): void

The listener will be triggered when JimuLayerView visibility is changed.

Parameters
ParameterType
listener
JimuLayerViewsVisibleChangedListener
Returns 
void

addLayerAndCreateJimuLayerView

Class Method
addLayerAndCreateJimuLayerView(layerLayer, dataSourceDataSource): Promise<JimuLayerView>

Add layer into map and create JimuLayerView for it. The dataSource is the related data source of the layer. In most cases, layer is created by dataSource.createJSAPILayerByDataSource() method.

Parameters
ParameterType
layer
Layer
dataSource
DataSource
Returns 
Promise<JimuLayerView>

clearSelectedFeatures

Class Method
clearSelectedFeatures(): void

Clear the selected features.

Returns 
void

createJimuLayerView

Class Method
createJimuLayerView(layerOrSubLayerLayer | ArcGISSubLayer, parentJimuLayerIdstring, indexnumber, runtimeAddedDataSource?DataSource, fromRuntime?boolean): Promise<JimuLayerView>

Create the JimuLayerView and add it into the jimuLayerViews object. Resolve the promise when it is ready.

Parameters
ParameterTypeNotes
layerOrSubLayer
Layer | ArcGISSubLayer

the layer can be a Layer or a SubLayer

parentJimuLayerId
string

the layer's parent JimuLayerView ID

index
number

layer index

runtimeAddedDataSource
DataSource

Optional, the layer data source added at runtime.

fromRuntime
boolean

Optional, true means the JimuLayerView is created from runtime. e.g. The JimuLayerView is created by AddData widget at runtime. false means the layer is a builtin layer of WebMap or WebScene.

Returns 
Promise<JimuLayerView>

destroy

Class Method
destroy(): void

Destroy the JimuMapView instance and the ArcGIS Maps SDK for JavaScript View at the same time.

Returns 
void

getAllChildJimuLayerViews

Class Method
getAllChildJimuLayerViews(jimuLayerViewIdstring): JimuLayerView[]

Return all child JimuLayerViews.

Parameters
ParameterType
jimuLayerViewId
string
Returns 
JimuLayerView[]

getAllJimuLayerViews

Class Method
getAllJimuLayerViews(): JimuLayerView[]

Return all JimuLayerViews.

Returns 
JimuLayerView[]

getChildJimuLayerViewIds

Class Method
getChildJimuLayerViewIds(jimuLayerViewIdany): string[]

Return the direct child JimuLayerView ids.

Parameters
ParameterType
jimuLayerViewId
any
Returns 
string[]

getChildJimuLayerViews

Class Method
getChildJimuLayerViews(jimuLayerViewIdstring): JimuLayerView[]

Return the direct child JimuLayerViews.

Parameters
ParameterType
jimuLayerViewId
string
Returns 
JimuLayerView[]

getDataSourceIdByAPILayer

Class Method
getDataSourceIdByAPILayer(layerOrSubLayerLayer | ArcGISSubLayer): string

Get dataSourceId by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Parameters
ParameterTypeNotes
layerOrSubLayer
Layer | ArcGISSubLayer

ArcGIS Maps SDK for JavaScript Layer or Sublayer

Returns 
string

getJimuLayerViewByAPILayer

Class Method
getJimuLayerViewByAPILayer(layerOrSubLayerLayer | ArcGISSubLayer): JimuLayerView

Get JimuLayerView by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Parameters
ParameterTypeNotes
layerOrSubLayer
Layer | ArcGISSubLayer

ArcGIS Maps SDK for JavaScript Layer or Sublayer

Returns 
JimuLayerView

getJimuLayerViewByDataSourceId

Class Method
getJimuLayerViewByDataSourceId(dataSourceIdstring): JimuLayerView

Get JimuLayerView by dataSourceId.

Parameters
ParameterTypeNotes
dataSourceId
string

data source id

Returns 
JimuLayerView

getJimuLayerViewIdByAPILayer

Class Method
getJimuLayerViewIdByAPILayer(layerOrSubLayerLayer | ArcGISSubLayer): string

Get jimuLayerViewId by ArcGIS Maps SDK for JavaScript Layer or Sublayer.

Parameters
ParameterTypeNotes
layerOrSubLayer
Layer | ArcGISSubLayer

ArcGIS Maps SDK for JavaScript Layer or Sublayer

Returns 
string

getMapDataSource

Class Method
getMapDataSource(): MapDataSource

Get the map data source bound to JimuMapView.

Returns 
MapDataSource

getParentJimuLayerViews

Class Method
getParentJimuLayerViews(jimuLayerViewIdstring): JimuLayerView[]

Return all parent JimuLayerViews.

Parameters
ParameterType
jimuLayerViewId
string
Returns 
JimuLayerView[]

getSelectedFeatures

Class Method
getSelectedFeatures(): Promise<Graphic[]>

Get all selected features in the map.

Returns 
Promise<Graphic[]>

isDestroyed

Class Method
isDestroyed(): boolean

Indicates if the JimuMapView is destroyed or not. Returns true if the view is not created or if the view is destroyed, otherwise returns false.

Returns 
boolean

removeJimuLayerView

Class Method
removeJimuLayerView(jimuLayerViewJimuLayerView): void

Remove jimuLayerView from jimuMapView and destroy the jimuLayerView. Note, this method will also remove all the children jimuLayerViews.

Parameters
ParameterTypeNotes
jimuLayerView
JimuLayerView

Note, jimuLayerView.fromRuntime must be true.

Returns 
void

removeJimuLayerViewCreatedListener

Class Method
removeJimuLayerViewCreatedListener(listenerJimuLayerViewCreatedListener): void

Remove the JimuLayerViewCreatedListener.

Parameters
ParameterType
listener
JimuLayerViewCreatedListener
Returns 
void

removeJimuLayerViewRemovedListener

Class Method
removeJimuLayerViewRemovedListener(listenerJimuLayerViewRemovedListener): void

Remove the JimuLayerViewRemovedListener.

Parameters
ParameterType
listener
JimuLayerViewRemovedListener
Returns 
void

removeJimuLayerViewsVisibleChangeListener

Class Method
removeJimuLayerViewsVisibleChangeListener(listenerJimuLayerViewsVisibleChangedListener): void

Remove the JimuLayerViewsVisibleChangedListener.

Parameters
ParameterType
listener
JimuLayerViewsVisibleChangedListener
Returns 
void

removeLayerFromMap

Class Method
removeLayerFromMap(targetLayerIdstring): void
Parameters
ParameterType
targetLayerId
string
Returns 
void

selectFeaturesByGraphic

Class Method
selectFeaturesByGraphic(graphicGraphic, spatialRelationshipstring, selectionModeDataSourceSelectionMode, options?{ filterJimuLayerView?: (jimuLayerViewJimuLayerView) => boolean; returnAllFields?: boolean; returnFullGeometry?: boolean }): Promise<{}>

Select features in all layers in the map by a graphic.

Parameters
ParameterTypeNotes
graphic
Graphic

This is the ArcGIS Maps SDK for JavaScript Graphic .

spatialRelationship
string

This parameter defines the spatial relationship to query features in the layer, see details here.

selectionMode
DataSourceSelectionMode

This parameter is to indicate how the new select operation affects the original selection. It can only be the following enumeration values: New , AddToCurrent , RemoveFromCurrent , or SelectFromCurrent .

options
{ filterJimuLayerView?: (jimuLayerViewJimuLayerView) => boolean; returnAllFields?: boolean; returnFullGeometry?: boolean }

If options.returnAllFields is true, the returned features will contain all fields, otherwise the value will contain the necessary fields. If options.returnFullGeometry is true, the returned features will have full precision geometry. By default, this method selects all eligible JimuLayerViews in the map. If you only want to select some specific JimuLayerViews, you can set options.filterJimuLayerView, which is a callback function. If the return value is true, it will be selected, otherwise it will not be selected.

Returns 
Promise<{}>

whenAllJimuLayerViewLoaded

Class Method
whenAllJimuLayerViewLoaded(): Promise<JimuLayerViews>

return the loaded JimuLayerViews only

Returns 
Promise<JimuLayerViews>

whenJimuLayerViewLoaded

Class Method
whenJimuLayerViewLoaded(jimuLayerViewIdstring): Promise<JimuLayerView>

Return the JimuLayerView when it's loaded.

For a JimuLayerView id, the instance may not have been created, but we can make sure the first level JimuLayerView are created. So, for a JimuLayerView id, we'll make sure its parent JimuLayerView get created and ready, and the JimuLayerView will create its children JimuLayerViews in the ready().

Parameters
ParameterType
jimuLayerViewId
string
Returns 
Promise<JimuLayerView>

whenJimuLayerViewLoadedByDataSource

Class Method
whenJimuLayerViewLoadedByDataSource(dsDataSource): Promise<JimuLayerView>
Parameters
ParameterType
ds
DataSource
Returns 
Promise<JimuLayerView>

whenJimuMapViewLoaded

Class Method
whenJimuMapViewLoaded(): Promise<JimuMapView>

Resolve the JimuMapView when it is loaded.

Returns 
Promise<JimuMapView>

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