portal-webitem-map
This bundle allows to use items from ArcGIS Enterprise portal or ArcGIS Online in map.apps.
It creates a map-widget.MapWidget
based on a JSON configuration referencing an item.
The resulting map widget is registered at the component system with the widget role map
.
Usage
To configure the portal item in the app.json
file, use:
{
"bundles" :{
"portal-webitem-map" : {
"Config" : {
"portalItem": {
"id": "31874da8a16d45bfbc1273422f772270"
}
}
}
}
}
The default portal from which the item is loaded is configured by the application.properties
key esri.api.arcgisPortalUrl
.
An alternative is to configure the portal
property:
{
"bundles": {
"portal-webitem-map": {
"Config": {
"portalItem": {
"id": "f001e7e2d9f94460a6c10cff4a9d03e6",
"portal": "https://myserver/arcgis"
}
}
}
}
}
It is possible to customize the view properties of the created SceneView or MapView by adding a view
property to the configuration:
{
"bundles": {
"portal-webitem-map": {
"Config": {
"portalItem": {
"id": "f001e7e2d9f94460a6c10cff4a9d03e6",
"portal": "https://myserver/arcgis"
},
"view": {
"viewmode": "2D"
}
}
}
}
}
The view configuration is equal to the map-init bundle.
Motivation
This bundle provides a common JSON-based configuration format to reference a WebMap or WebScene from a portal.
The goals are:
- Provide a common configuration format for WebMaps and WebScenes.
- Provide a common place for the main map configuration with WebMap or WebScene in the
app.json
file. - Provide a way for other bundles to create custom map-widget based portal items.
Extended Use Cases
Create a non-default map widget
Custom bundles can reuse the configuration format to create custom map widgets.
A map widget can be created by using the configuration interpreter.
The configuration interpreter can be referenced by the following declaration in your manifest.json
file:
{
"name": "YourComponent",
"references": [
{
"name": "interpreter",
"providing": "portal-webitem-map.Interpreter"
}
]
}
YourComponent can then trigger the interpretation of a portal item:
// the map configuration
let portalItem = ...
// the portal-webitem-map.Interpreter
let interpreter = this.interpreter;
// trigger interpretation
interpreter.interpret({portalItem : portalItem}).toMapWidget()
// a Promise is returned
.then(({map,mapWidgetModel,mapWidget}) => {
// do something with the created parts
});
// if you are only interested in a MapWidgetModel do:
interpreter.interpret({portalItem : portalItem}).toMapWidgetModel()