Configure the app

App configuration

Overview

This configuration section contains some basic app properties and three main properties: map, preloadWidgets, and widgetPool.

Attributes

  • theme: object; Theme has two properties:
    • Name:
    • styles: All styles of the theme. The viewer uses the first style. If omitted, the viewer will not load theme.
      If omitted, the viewer will not load theme.
  • locale: String; default: Browser’s locale; If omitted, the browser’s locale is used, can be overridden by the locale URL parameter.
  • splashPage: String | object; If it’s a String, points to the splash widget main class. If it’s an object, the property is the same as the widget. If omitted, there is no splash page.
  • httpProxy: String—proxy.jsp, proxy.php, proxy.asp, depends on the web server.
  • portalUrl: String; If viewer integrates with portal, set the portal URL here.
  • *logo: String—URL points to the logo file.
  • *title: String—Title of the viewer.
  • *subtitle: String—Subtitle of the viewer.
  • links: Set some links that can link to other resources. Each link has two properties, that is, url and label.
  • *map: See the map’s configuration.
  • preloadWidgets: object. Can contain some widgets and widget groups. All widgets and groups in this object loads by the viewer when the viewer loads.
  • widgetPool: object; Can contain some widgets and widget groups. All widgets groups in this object wwill not load by default, and these widgets are used for controller widgets (a widget that can read this configuration, and can start and close these widgets by sending messages to the viewer).

Map configuration

Overview

Attributes

  • 3D: Boolean; default: false— Is the map 3D or 2D? If both 3D and 2D is true, it’s an app with the ability to switch between 2D and 3D (not supported in this version).
  • 2D: Boolean; default: true—Is the map 3D or 2D? If both 3D and 2D is true, it’s an app with the ability to switch 2D and 3D (not supported in this version).
  • itemId: String—webmap ID or webscene ID.
  • mapOptions: object—This property iis the same as the map API.
  • position: object; default: {left:0,Top:0,Bottom:0,Right:0}—The map’s position. The viewer uses six properties to position: left, top, bottom, right, width, height, which is the same as the browser.

Widget configuration

Overview

Attributes

  • id: String—If omitted, the viewer generates one.
  • *label: String—The widget display name.
  • *uri: String—The widget main class, derived from BaseWidget.
  • icon: String—If omitted, the default icon is the images/icon.png. You can set this property to point to another PNG file. Suggestions:
    • Do not define this property if you use a widget only one time.
    • If you use a widget more than one time, put the icon file in the images folder, and name it as icon_{label}.png
  • config: String|object—Widget configuration, the format depends on the widget. It can be:
    • url points to the config file
    • Config object
    If omitted, the default config.json file in the widget folder is used. If it exists:
    • Do not define this property if you use a widget only one time.
    • If you use a widget more than one time, put the configuration file in the widget folder and name it config_{label}.json.

Preload widget configuration

Overview

Attributes

  • panel: object; default—BaseWidgetPanel; Should have URI property. All widgets (not in group) display in this panel.
  • widgets: Array of widgets. Each widget has two Additional properties:
    • position: Same as the map’s position
    • positionRelativeTo: String; default— map. Valid value is map or browser.
  • groups: Array of group.

Widget Pool configuration

Overview

Attributes

  • panel: object; default—BaseWidgetPanel; See the panel’s config. All widgets (not in group) display in this panel.
  • widgets:Array of widget.
  • groups: Array of group.

Panel configuration

Overview

Attributes

  • uri: String; default— BaseWidgetPanel; The Panel’s main class, derived from BaseWidgetPanel.
  • position: object—The position of the panel, same as the map’s position.
  • positionRelativeTo: String; default: map; —Valid value is map or browser.

Group configuration

Overview

Attributes

  • *label: string;
  • *widgets: [];
  • panel: object; default —Parent object’s panel; All widgets in this group display in this panel. If omitted, the parent object’s panel is used.

Configure Widgets

AttributeTable

Overview

The Attribute Table widget displays a tabular view of a feature layer’s attributes.

Attributes

  • *layers: Object[]; default: no default —An array of feature layers.
    • *name: String; default: no default —The name of the feature layer.
    • *layer: Object[]; default: no default —Reference to the feature layer.
      • *url: String; default: no default —URL to the ArcGIS Server REST resource that represents a feature service.
    • selectionSymbol: Object, a JSON object of symbol of ArcGIS JavaScript API; default: no default; Set’s the selection symbol for the feature layer.
    • linkfield: String, default: no default —Refers to a field that contains URL values.
  • table: Object; default: —No default.
    • pageSizeOptions: Number[]; default: no default —An optional array specifying choices to present for the rowsPerPage property in a drop-down. If unspecified or empty, no drop-down displays (the default behavior).
  • hideExportButton: Boolean; default: false —There is not a function of exporting CSV file.

Example:

{
  "layers": [{
    "name": "Wildfire Response Points",
    "layer": {
      "url": "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0"
    },
  }, {
    "name": "USA Earthquake Faults",
    "layer": {
      "url": "http://maps1.arcgisonline.com/ArcGIS/rest/services/USGS_Earthquake_Faults/MapServer/1"
    },
    "linkfield": "WWWURL"
  }],
  "table": {
    "pageSizeOptions": [25, 50, 100, 1000]
  }
}

BasemapGallery

Overview

The BasemapGallery widget displays a collection of basemaps from ArcGIS.com or a user-defined set of maps or image services. When a new basemap is selected from the BasemapGallery, the basemap layers are removed from the map and the new layers are added. All basemaps added to the gallery need to have the same spatial reference. If default ArcGIS.com basemaps are used, all additional items added to the gallery need to be in Web Mercator (WKIDs: 102100, 102113, and 3857). If default basemaps are not used, you can add basemaps in any spatial reference as long as all the items added to the gallery share that spatial reference. To achieve the best performance, all basemaps added to the gallery are cached (tiled) layers.

Attributes

  • basemapGallery:An object of ArcGIS API for JavaScript. See the params of BasemapGallery Constructor.
    • basemaps: Object[]; default: no default —An array of user-defined basemaps to display in the BasemapGallery. See the params of Basemap Constructor.
      • layers: Object[]; default: no default —An array of layers to add to the basemap. See the params of BasemapLayer Constructor.

Example:

{
  "basemapGallery": {
    "showArcGISBasemaps": true,
    "basemaps": [{
      "layers": [{
        "url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
      }],
      "title": "Street (Customized)",
      "thumbnailUrl": "images/streets.jpg"
    }, {
      "layers": [{
        "url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
      }],
      "title": "Topo (Customized)",
      "thumbnailUrl": "images/topo.jpg"
    }, {
      "layers": [{
        "url": "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"
      }],
      "title": "Imagery (Customized)",
      "thumbnailUrl": "images/imagery.jpg"
    }]
  }
}

Bookmark

Overview

The Bookmark widget applies for both 2D and 3D maps. For 2D maps, it stores a collection of map view extents. For 3D maps, it stores a collection of camera. It also enables end users to add and delete their own bookmarks. Web map bookmarks are automatically used if available.

Attributes

  • bookmarks2D: Object[]; default: no default —The 2D map bookmarks.

    • *name: String; default: no default —The bookmark name.
    • *extent: Object; default: no default; the map extent —The object is the same as the object returned by Extent.toJson() method in JS API. See Extent to get more details.
    • *thumbnail: String; default: images/thumbnail_default.png. As a recommendation, put all images in the images folder.
  • bookmarks3D: Object[]; default: no default; The 3D map bookmarks.

    • *name: String; default: no default —The bookmark name.
    • *camera: Number[]; default: no default —The camera is an array with the length of 5 or 6. The first fifth of the array is x, y, z, heading, tilt, and the sixth is the WKID. The sixth is optional, if not set, the default WKID is 4326.
    • *thumbnail: String; default: “images/thumbnail_default.png”. As a recommendation, put all of the images under in the images folder.

Chart

Overview

The Chart widget displays quantitative attributes from a map layer as a graphical representation of data. It makes it easy for end users to observe possible patterns and trends in quantitative attribute data, as charts can usually be read more quickly than the raw data from which they are produced.

Attributes

  • geometryService: String; default — http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer; The geometry service URL.

Example:

"geometryService": "http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"
  • layers: Object[]; default: no default —Container for the chart’s layer sources. Each element has the following child attributes:
    • label: String; default: no default —The layer name displayed in the widget.
    • url: tring; default: no default —The uniform resource locator (URL) address of the layer to query for data. This is an individual layer in a service and normally ends with a number, such as …/MapServer/0.
    • labelField: String; default: no default —This field is used as the chart’s category field. For example, if the label field is NAME, this field is used to categorize the chart data.
    • fields: String[]; default: no default —Container for the retrieved fields.
    • medias: Object[]; default: no default — Which medias to display. Each element includes information on how to display media in the Chart widget and has the following child attributes:
      • chartField: String; default: no default —Field name (one single field per chart) for data shown in the chart.
      • title: String; default: no default —Title to display.
      • type: String; default: no default —Type of chart to display. Valid values are barschart, columnschart, linechart, and piechart.
"layers":[
  {
    "label":"Cities",
    "url":"http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0",
    "labelField":"CITY_NAME",
    "fields":["CITY_NAME","POP","POP_RANK"],
    "medias":[
      {
        "chartField":"POP",
        "title":"POP Bar Chart",
        "type":"barschart"
      },
      {
        "chartField":"POP",
        "title":"POP Column Chart",
        "type":"columnschart"
      },
      {
        "chartField":"POP",
        "title":"POP Line Chart",
        "type":"linechart"
      },
      {
        "chartField":"POP",
        "title":"POP Pie Chart",
        "type":"piechart"
      }
    ]
  }
]

Coordinate

Overview

The Coordinate widget displays x, y-coordinates dynamically when the pointer moves around the map. By default, the coordinate values are based on the spatial reference of the first basemap.

Attributes

  • outputunit: String; default: geo; Valid values are dms and geo. dms: The output formlooks like 26° 3211 N 123° 37′12 W. geo: The output format looks like Latitude: 26.497302 Longitude: -120.851562.
  • spatialReferences: Object[]; default: no default; Shows a pop-up menu containing all configured spatial references when the mouse hovers over the widget.
    • wkid: Number; default: no default; Well-known ID. For more details see
      https://developers.arcgis.com/en/javascript/jshelp/ref_coordsystems.html.
    • label: String, default: no default; A label for the specified WKID.
    • transformationWkid: Number;default: no default; The well-known id {wkid:number} for the datum transfomation to be applied on the projected geometries.
    • transformationLabel: String, default: no default; The well-known text {wkt:string} for the datum transfomation to be applied on the projected geometries.

Example:

{
  "outputunit": "dms",
  "spatialReferences": [{
    "wkid": 2000,
    "label": "Anguilla_1957_British_West_Indies_Grid"
  },{
    "wkid": 2001,
    "label": "Antigua_1943_British_West_Indies_Grid"
  },{
    "wkid": 2274,
    "label": "NAD_1983_StatePlane_Tennessee_FIPS_4100_Feet"
  }]
}

Directions

Overview

The Directions widget provides a quick and efficient method of calculating directions between two or more locations. The widget generates a route finding a least-cost path between two or more locations using a specified network service. The Directions widget is pre-configured to work with the ArcGIS Online Network Analysis Services. These services require an ArcGIS Online Organization subscription. If you choose to work with this default, specify a valid user name and password for ArcGIS Online. Each successful request to the service incurs service credits taken from your subscription.

Attributes

  • routeTaskUrl: String; default—http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World. The URL address of the network route service.

Example:

"routeTaskUrl":"http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"
  • locatorUrl: String; default—http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer. The URL address of the geocoding service.

Example:

"locatorUrl":"http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
  • geocoderOptions: Object; default: no default;
    • autoComplete: boolean; default: true —The value indicating whether autocomplete is enabled.

Example:

"geocoderOptions": {
  "autoComplete":true
}

Draw

Overview

The Draw widget enables end users to draw basic graphics and text on the map.

Attributes

  • distanceUnits: Object[]; default: no default; The distance units used to measure.
    • unit: String; default: no default —The unit name.
    • abbr: String; default: no default —The unit abbreviation.

Example:

"distanceUnits": [{
  "unit": "KILOMETERS",
  "abbr": "km"
}, {
  "unit": "MILES",
  "abbr": "mi"
}, {
  "unit": "METERS",
  "abbr": "m"
}, {
  "unit": "FEET",
  "abbr": "ft"
}, {
  "unit": "YARDS",
  "abbr": "yd"
}]
  • areaUnits: Object[]; default: no default —The area units used to measure.
    • unit: String; default: no default —The unit name.
    • abbr: String; default: no default —The unit abbreviation.

Example:

"areaUnits": [{
  "unit": "SQUARE_KILOMETERS",
  "abbr": "sq km"
}, {
  "unit": "SQUARE_MILES",
  "abbr": "sq mi"
}, {
  "unit": "ACRES",
  "abbr": "ac"
}, {
  "unit": "HECTARES",
  "abbr": "ha"
}, {
  "unit": "SQUARE_METERS",
  "abbr": "sq m"
}, {
  "unit": "SQUARE_FEET",
  "abbr": "sq ft"
}, {
  "unit": "SQUARE_YARDS",
  "abbr": "sq yd"
}]

Edit

Overview

The Edit widget provides editing capabilities using an editable layer in a feature service. It combines the TemplatePicker, AttachmentEditor, AttributeInspector, and GeometryService to provide feature and attribute editing.

Attributes

  • editor: An object of ArcGIS API for JavaScript. Refer to the params of Editor constructor at https://developers.arcgis.com/en/javascript/jsapi/editor-amd.html#editor1.
    • layerInfos: Object; default: no default —Feature layer information.
      • featureLayer: Object; default: no default —Reference to the feature layer.
        • url: String; default: no default —URL to the ArcGIS Server REST resource that represents a feature service.

Example:

{
  "editor": {
    "createOptions": {
      "polylineDrawTools": ["freehandpolyline"],
      "polygonDrawTools": [
        "freehandpolygon",
        "autocomplete"
      ]
    },
    "enableUndoRedo": true,
    "toolbarVisible": true,
    "toolbarOptions": {
      "mergeVisible": true,
      "cutVisible": true,
      "reshapeVisible": true
    },
    "layerInfos": [{
      "featureLayer": {
        "url": "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0"
      },
      "disableGeometryUpdate": true,
      "fieldInfos": [{
        "fieldName": "rotation",
        "isEditable": false
      }, {
        "fieldName": "description",
        "isEditable": true
      }, {
        "fieldName": "eventdate",
        "label": "Event Date",
        "isEditable": false
      }, {
        "fieldName": "eventtype",
        "label": "Event Type",
        "isEditable": false
      }]
    }, {
      "featureLayer": {
        "url": "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/1"
      },
      "disableGeometryUpdate": true,
      "fieldInfos": [{
        "fieldName": "symbolid",
        "isEditable": false
      }, {
        "fieldName": "description",
        "isEditable": true
      }]
    }]
  }
}

Geocoder

Overview

Adds a geographic search box to an application. The widget defaults to the ArcGIS Online World Geocoding Service but is customizable to use one or more ArcGIS Server geocoding services.

Attributes

Example:

{
  "geocoder": {
    "autoComplete": true,
    "minCharacters": 3,
    "arcgisGeocoder": {
      "placeholder": "Find address or place"
    }
  }
}

Geoprocessing

Overview

Configures and rus the geoprocessing task.

Attributes

  • *taskUrl: String; default: no default —The URL to the geoprocessing task.
  • helpUrl: String; default: no default —The URL to the Help for this geoprocessing task.

  • *isSynchronous: Boolean; default: no default —The GP’s execution type.

  • updateDelay: Number; default: no default —The time interval in milliseconds between each job status request sent to an asynchronous GP task.

  • useResultMapServer: Boolean; default: false —Boolean value indicating whether to bypass a geoprocessing service’s resulting map service. If true, any configured rendering is ignored as the GP widget uses the resulting map service to display results.

  • shareResults: Boolean; default: false —If true, adds the resulting output as an operational layer to the map. Boolean value. Default is false.

  • inputParams: Object[]; default —Depends on the GP service. The input parameters for the geoprocessing task. Each parameter has the following properties:

    • *name: String; default: no default —Name of the input parameters as defined on the server.
    • *dataType:String; default: no default—Parameter type.. Valid values are: GPLong, GPDouble, GPString, GPBoolean, GPLinearUnit, GPDate, GPDataFile, GPRasterDataLayer, GPRecordSet, GPFeatureRecordSetLayer, and GPMultiValue.
      For GPRecordSet type, input features are only supported as table input (input features as table input are only supported). Currently, GPDataFile is not supported.

    • label: String; default: no default—Parameter label to display in the widget instead of the parameter name. Optional.

    • defaultValue: String|Object; default: no default —The meaning is the same as the GP task parameter property. See Task parameter properties. If the dataType is GPRecordSet or GPFeatureRecordSetLayer, the defaultValue is required.

    • featureSetMode: String; default: no default —The input mode for the featurerecordset input parameters. Only applicable for FeatureRecordSet type. Valid values are: draw, layers, and url.

    • featureSetUrl: String; default: no default —Only valid when the featureSetMode value is url.

    • choiceList: String; default: no default —Used to provide options in a drop-down list. Only applies to input parameters of types string and linearunit.

    • tooltip: String; default: no default —The ToolTip for the input parameter.

    • visible: Boolean; default: true —If false, this parameter is not visible.

    • editorName: String; default: no default —User can change the input editor when the data type is GPString.

    • editorDependParamName: String; default: no default —One parameter may depend on another parameter’s value, such as the LayerFieldChooser editor depends on the layer parameter.

  • outputParams: Object[]; default: no default —The GP’s output parameters configuration.

  • layerOrder: String[]; default: no default —List of output feature type parameter names.

HeaderController

Overview

The HeaderController widget reads and displays application information, such as the title and logo. In addition, it reads widget pool configurations and displays the widget/group icon. When users click a specific icon in it, the corresponding widget/group opens or closes.

Attributes

  • groupSetting: Object[]; default: no default —The array of the groups setting. The groups come from the widget pool. Each setting has two properties: label and type. The label should be the same as the group label in the widget pool. The type has two options: dropDown and openAll. If it’s dropDown, when users click the group icon, a drop-down menu appears. If it’s openAll, when users click the group icon, all widgets in the group open.

HistogramTimeSlider

Overview

The HistogramTimeSlider widget provides a histogram chart representation of data for time-enabled layers on a map. Through the UI, users can temporarily control the display of data with an extension to the Esri timeslider.

Attributes

  • histogramTimeSlider: An object of ArcGIS API for JavaScript. See the params of HistogramTimeSlider Constructor.
    • layers: Object[]; default: no default —An array of feature layers. See the options parameter of FeatureLayer Constructor.
      • options: Object; default: no default —Optional parameters.

Example:

{
  "histogramTimeSlider": {
    "dateFormat": "DateFormat(selector: 'date', fullYear: true)",
    "mode": "show_all",
    "timeInterval": "esriTimeUnitsYears",
    "layers": [{
      "url": "http://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/U2/FeatureServer/0",
      "options": {
        "id": "u2",
        "outFields": ["*"],
        "infoTemplate": {
          "title": "U2 Concerts:  1980  2011",
          "content": "Date:  ${Date:DateFormat(selector: 'date', fullYear: true)}<br>Venue:  ${Venue}, ${City}, ${State}<br>Tour:  ${Tour}"
        }
      }
    }]
  }
}

HomeButton

Overview

HomeButton provides a basic button to return to the map’s default starting extent.

Attributes

  • homeButton: An object of ArcGIS API for JavaScript. See the params of HomeButton Constructor.
    • extent: Object. A JSON object for the Extent in ArcGIS JavaScript API. The default is null —The extent used to zoom to when clicked. If null, uses the starting extent. See the JSON parameter of Extent Constructor.

Example:

{
  "homeButton": {
    "extent": {
      "xmin": -122.68,
      "ymin": 45.53,
      "xmax": -122.45,
      "ymax": 45.6,
      "spatialReference": {
        "wkid": 4326
      }
    }
  }
}

LayerList

Overview

The LayerList widget displays operational layers on the map and provides application with the ability to turn operational layers on and off. The layerList widget also provides some operations for operational layers (zoom to, transparency, move down/move up, open width table and description).

Attributes

  • showLegend: Boolean; default: true —Indicates whether to display the legend or not.

Legend

Overview

The Legend widget displays a label and symbol for some or all layers on the map. If specified, the legend respects scale dependencies, and only displays layers and sub layers currently visible on the map. The legend automatically updates if the visibility of a layer or sub layer changes.

Attributes

Example:

{
  "legend":{
    "arrangement": 0,
    "autoUpdate": true,
    "respectCurrentMapScale": true
  }
}

Measurement

Overview

The Measurement widget provides tools that calculate the current location (Get Location), and measure distance (Measure Distance), and area (Measure Area). If the map’s coordinate system is not Web Mercator or geographic, or if complex polygons are drawn, this widget needs to use the geometry service to project or simplify geometries.

Attributes

Example:

{
  "measurement": {
    "pointSymbol": {
      "type": "esriSMS",
      "style": "esriSMSSquare",
      "color": [76, 115, 0, 255],
      "size": 8,
      "angle": 0,
      "xoffset": 0,
      "yoffset": 0,
      "outline": {
        "color": [152, 230, 0, 255],
        "width": 1
      }
    }
  }
}

MyLocation

Overview

MyLocation provides a basic button to locate and zoom to the user’s current location.

Attributes

Example:

{
  "locateButton": {
    "geolocationOptions": {
      "timeout": 10000
    },
    "highlightLocation": true
  }
}

OverviewMap

Overview

The OverviewMap widget displays the current extent of the map within the context of a larger area. The OverviewMap widget updates when the map extent changes. The extent of the main map is represented in the overview map area as a rectangle. Drag the extent rectangle to modify the extent of the main map.

Attributes

  • overviewMap: An object of ArcGIS API for JavaScript. See the params for OverviewMap constructor.
  • minWidth: Number. The default is 200. This is the minimal width of OverviewMap.
  • minHeight: Number. The default is 150. This is the minimal height of OverviewMap.
  • maxWidth: Number. The default is 400. This is the maximum width of OverviewMap.
  • maxHeight: Number. The default is 300. This is the maximum height of OverviewMap.

Example:

{
  "overviewMap":{
    "visible": false
  },
  "minWidth": 200,
  "minHeight": 150,
  "maxWidth": 400,
  "maxHeight": 300
}

Print

Overview

The Print widget works with the PrintTask class, which generates a printer-ready version of the map through the new ExportWebMap server task in ArcGIS 10.1 and up. Configure this task with the custom layout templates. It also provides a set of output types, such as PDF, PNG, and SVG. The ExportWebMap server task works by taking the current map to define display content, extent, and symbology.

Attributes

  • serviceURL: String. There is no default. This is the URL to the Export Web Map Task REST endpoint (for example, http:///arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task). You can change the URL to your own Export Web Map Task (requires ArcGIS 10.1 and up for Server).
  • defaultTitle: String. There is no default. This is the default title for the printed output.
  • defaultAuthor: String. There is no default. This is the default author of the printed output.
  • defaultCopyright: String. There is no default. This is the default copyright of the printed output.
  • defaultFormat: String. There is no default. This is the default format of the printed output.
  • defaultLayout: String. There is no default. This is the default layout of the printed output.

Example:

{
  "serviceURL": "//utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task",
  "defaultTitle": "ArcGIS WebMap",
  "defaultAuthor": "",
  "defaultCopyright": "",
  "defaultFormat": "PDF",
  "defaultLayout": "Letter ANSI A Landscape"
}

Query

Overview

The Query widget enables end users to query information from a map service by executing a predefined query. It works on a single layer.

Attributes

  • layer: Object. There is no default.
    • url: String.There is no default. A layer URL for the layer you want to query.
    • expression: String. There is no default. This takes the form of a basic SQL statement.
    • textsearchlabel: String. There is no default. This is the text search label in the widget.
    • textsearchhint: String. There is no default. This is the text search hint.
    • titlefield: String. The default is the displayFieldName attribute of the layer. The main field to display for query results. If not specified, uses the layer’s displayFieldName attribute.
    • linkfield: String. There is no default. This refers to a field that contains URL values. If the URL link has an extension of .jpg, .png, or .gif, the image displays; otherwise, a clickable link displays. When the link is clicked, a new tab opens to display content referenced by the link.
    • fields:Object[]—There is no default. Choose the field you want to display in the output result.

Example:

"layer": {
    "url": "http://maps1.arcgisonline.com/ArcGIS/rest/services/USGS_Earthquake_Faults/MapServer/1",
    "expression": "NAME like '[value]'",
    "textsearchlabel": "Filter by Name  [ Example: Diamond Springs fault ]",
    "textsearchhint": "Name",
    "titlefield": "Name",
    "linkfield": "",
    "fields": {
      "all": false,
      "field": [{
        "name": "NAME",
        "alias": "Name"
      }]
    }
  }
  • defaultValue: String. The default is:‘’—The default value for the query.

Example:

"default": 'NAME'
  • zoomscale: Number; The default is —50000. For features with an unknown extent, a zoom scale can be set; otherwise, it zooms into the extent of the feature.

Example:

"zoomscale": 50000
  • symbol: Object. There is no default. The symbol used to represent the features.

  • shareResult: boolean—The default is false. If true, adds the query result as an operational layer to the map.

Example:

"shareResult": false

Scalebar

Overview

The Scalebar widget displays a scalebar on the map or in a specified HTML node. The widget respects various coordinate systems and displays units in English or metric values. When working with Web Mercator or geographic coordinate systems, the scalebar takes into account projection distortion and dynamically adjusts the scalebar.

Attributes

Example:

{
  "scalebar": {
    "scalebarStyle": "line",
    "scalebarUnit": "dual"
  }
}

Overview

The Search widget enables end users to search for features in a specific layer. The widget provides two options to perform a search: spatially (using a graphical search tool) or by attribute (text search).

Attributes

  • layers: Object. There is no default. The layers used to search.
    • name: String. There is no default. The layer name displayed in the widget.
    • url: String. There is no default. The layer’s URL.
    • expression: String. There is no default. Predefined query for the widget used in the Select by attribute search. For example, eventtype = ‘[value]’. ’[value]’ is a literal value that needs to be specified in the expression.
    • textsearchlabel: String. There is no default. The search label displayed in the Select by attribute panel.
    • textsearchhint: String. There is no default. The text search hint.
    • titlefield: String. The default is the layer’s displayFieldName attribute. The main field to display for query results. If not specified, uses the layer’s displayFieldName attribute.
    • linkfield: String. There is no default. Refers to a field that contains URL values. If the URL link has an extension of .jpg, .png, or .gif, the image displays; otherwise, a clickable link displays. When the link is clicked, a new tab opens to display content referenced by the link.
    • fields:Object. There is no default. The fields’ info for query and display.
      • all:Boolean. The default is false. If true, all fields display.
      • field:Object.There is no default. The fields display.
        • name: String. There is no default. The field name.
        • alias: String. There is no default. The field alias.

Example:

"layers": [{
  "name": "USA Earthquake Faults (Line)",
  "url": "http://maps1.arcgisonline.com/ArcGIS/rest/services/USGS_Earthquake_Faults/MapServer/1",
  "expression": "NAME like '[value]'",
  "textsearchlabel": "Search by Name  [ Example: Diamond Springs fault ]",
  "textsearchhint": "Name",
  "titlefield": "Name",
  "linkfield": "",
  "fields": {
    "all": false,
    "field": [{
      "name": "NAME",
      "alias": "Name"
    }, {
      "name": "AGE",
      "alias": "Age"
    }]
  }
}, {
  "name": "Global Natural Hazards",
  "url": "http://maps.ngdc.noaa.gov/arcgis/rest/services/web_mercator/hazards/MapServer/1",
  "expression": "CAUSE like '[value]'",
  "textsearchlabel": "Search Hazards by CAUSE... [ Example: Earthquake% ]",
  "textsearchhint": "Natural Hazards Cause",
  "titlefield": "CAUSE",
  "linkfield": "",
  "fields": {
    "all": false,
    "field": [{
      "name": "CAUSE",
      "alias":"Cause"
    }]
  }
}]
  • zoomscale: Number. The default is 10000. For features with an unknown extent, a zoom scale can be set; otherwise, it zooms into the feature’s extent.

Example:

"zoomscale": 10000
  • symbols: Object. There is no default. The symbol used to represent the features.

Example:

"symbols": {
  "simplemarkersymbol": {
    "type": "esriSMS",
    "style": "esriSMSSquare",
    "color": [76, 115, 0, 255],
    "size": 8,
    "outline": {
      "color": [152, 230, 0, 255],
      "width": 1
    }
  },
  "picturemarkersymbol": null,
  "simplelinesymbol": null,
  "simplefillsymbol": null
}
  • shareResult: Boolean. The default is false. If true, adds the search results as an operational layer to the map.

Example:

"shareResult": false