8 votes
Accepted

Error Multiple Define when loading base script

This error is caused by having jquery/jqueryUI loading at the same time from Esri's Dojo configuration and in our script. Per the thread here, putting the Esri script at the bottom of the page after ...
user avatar
  • 251
8 votes
Accepted

ArcGIS JavaScript: Uncaught Type Error

The major problem I see is that you are trying to use a MapService as a TileLayer. Since the MapService you specified is not tiled, try using the MapImageLayer type. This will stop throwing the ...
user avatar
  • 8,374
5 votes
Accepted

How to get current Basemap in ArcGIS for JavaScript 4.4 using BasemapGallery widget

I got an email response from an Esri representative. Copied below: "BasemapGallery doesn't have any events. If you would like to execute custom behavior whenever the active basemap changes, or the ...
user avatar
  • 684
5 votes
Accepted

ArcGIS JS API SimpleMarkerSymbol is not a subclass of Layer

It's because your function arguments don't match up with your require modules. These must be in the same order! require([ "esri/Map", "esri/views/MapView", "esri/layers/TileLayer", "esri/layers/...
user avatar
  • 5,288
4 votes

How to add popups to MapImageLayer (JavaScript API 4.0 esri)

You can use identifyTask to configure the popupTemplate for each sublayer of your MapImageLayer. See the following sample: IdentifyTask JSAPI 4.0
user avatar
  • 86
4 votes
Accepted

Watching for scale/zoom changes in ArcGIS API for JavaScript 4?

The practice in version 3.x of the ArcGIS API for JavaScript of using event listeners has been superseded in 4.x by a new paradigm: watchable properties. from the documentation: Prior to 4.0, ...
user avatar
  • 5,053
4 votes
Accepted

LayerList in WebMap

When creating your layerlist, you can designate the html element in which it will be placed by using the container property like so: var layerList = new LayerList({ view: mapView, container: '...
user avatar
  • 156
4 votes

Point cluster in ArcGIS Javascript API 4.3?

Unfortunately, this is not possible through the current version it is planned though as future updates occur for this version. ArcGIS API for JavaScript 3.20 Does have this capability.
user avatar
  • 11.9k
4 votes

Loading GeoJSON into map using JavaScript API in ESRI

Check out this code snippet/post: Importing GeoJSON data in ArcGIS Javascript maps function requestData() { var requestHandle = esriRequest({ url: "data/sample.json", callbackParamName: "...
user avatar
  • 34.6k
4 votes
Accepted

Get FeatureLayer Attribute by Clicking

You need to use the hitTest(screenPoint) method, to search for graphics at the clicked location, after you get the screenPoint from the view-click event. function displayTractID(event) { var ...
user avatar
  • 1,006
4 votes
Accepted

ArcGIS JS API Failed to load feature layer

First, your graphics should be wrapped in an array. Simply change var featureLayer = new FeatureLayer({ source: graphic, fields: fields, objectIdField: ...
user avatar
4 votes
Accepted

How to disable map navigation in the ArcGIS Server JavaScript API v4.x

It seems to completely disable map navigation (under a condition, like you asked) you would need to stop event propagation from certain events. view.on(["click", "drag", "...
user avatar
  • 2,597
4 votes
Accepted

How to grey-out area outside of a Polygon?

I would calculate the spatial difference between the area of interest and view extent, and display it as greyed-out. Something like this: var polygon = new Polygon({ rings: [ [-118....
user avatar
3 votes
Accepted

Cannot catch click event on FeatureLayer in ArcGIS API for JavaScript 4?

I finally figured out how to catch these events. I'm not allowed to listen for click events on a FeatureLayer, nor on a Map, but I still can listen it on my SceneView, and use the hitTest() function ...
user avatar
  • 183
3 votes
Accepted

How to highlight a clicked Feature Layer using ArcGIS JS API 4.x

This was answered on the Esri forums at https://geonet.esri.com/message/609517#comment-609517 view.on("click", function(event) { view.hitTest(event.screenPoint).then(function(response) { ...
user avatar
  • 20.5k
3 votes
Accepted

Change the basemap background color from white to black in arcgis js api?

Quite simple , Just Add a line of css in your webApp in which you change the background of the map div container : if you're using js api 2.x-3.x : #map_root { background-color:black; } if you're ...
user avatar
  • 947
3 votes

Arcgis JS API 4.x how to localize?

I think, theoretically, it is possible to npm install JS API from Esri GitHub repository, and before making a Custom Build of JS API edit strings in localization files — they are situated in t9n ...
user avatar
3 votes
Accepted

Unable to increase Esri Map size

The default height is 400px, so you will need custom CSS. In many of the examples, you will see CSS like this: <style> html, body, #mapDiv { padding:0; margin:0; height:100%; }...
user avatar
3 votes
Accepted

Map contents don't print when using CSS media print queries in a Bootstrap modal

Unfortunately, cloneNode will not copy image data from a canvas. A possible solution is to use the Views takeScreenshot method to copy the imageData from the map and then add it to the copied canvas. ...
user avatar
3 votes
Accepted

Controlling position of popup's actions?

There's two parts here: The top/bottom position of the action bar vs the main content. The location of the popup in relation to the selected feature. You can change the latter from "auto" to e.g. "...
user avatar
3 votes
Accepted

Authenticating using only token in ArcGIS API for JavaScript?

In the 4x JSAPI, unknown properties can't be added to the URL like that. Instead, you can use "interceptors" to add any custom logic to the requests being sent (and retrieved) by the API. For ...
user avatar
3 votes
Accepted

Using requirejs with ArcGIS API for JavaScript v 4 API from CDN?

Some of the issues are in your error. You're missing the requirejs configs for the @dojo and maquette modules. You can get an idea of what these might look like by looking at how we set up workers to ...
user avatar
3 votes

Loop through attribute ids of FeatureLayer

If you need all the ids up front, you can query the layer when your application starts and store them somewhere. The FeatureLayer query supports returnDistinctValues so you can get the distinct ids. ...
user avatar
3 votes
Accepted

Creating time series with heatmap using ArcGIS API for JavaScript

The heatmap renderer does not support FeatureLayerView filtering or effects. The workaround is to apply a FeatureLayer definition expression. Your updated app is here: https://codepen.io/...
user avatar
  • 71
3 votes
Accepted

Why is ArcGIS Server JavaScript API throwing a CORS error when Leaflet does not, for the same WMS layer?

Let me quote https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#what_requests_use_cors : This cross-origin sharing standard can enable cross-origin HTTP requests for: Invocations of the ...
user avatar
  • 9,390
2 votes

Loading Scene from ID into ArcGIS JavaScript API 4: "SyntaxError: Unexpected token ILLEGAL"

Your code is in fact correct. We can see this because changing the portal ID to the one from the sample code like so: var scene = new WebScene({ portalItem: new PortalItem({ id: "...
user avatar
  • 1,924
2 votes

Using the OS Open Background basemap with ArcGIS JS API 4

From the documentation: Known Limitations When adding an TileLayer to a map in a SceneView, the following limitations exist: If viewingMode is global, then only services with a Web Mercator spatial ...
user avatar
  • 890
2 votes

How to highlight a clicked Feature Layer using ArcGIS JS API 4.x

The code mentioned by Stephen can be used to get the coordinates of the clicked feature, then we can use graphic class(example: https://developers.arcgis.com/javascript/latest/sample-code/get-started-...
user avatar
  • 21
2 votes

How to set actions while click on popupTemplate in Arcgis javascript 4.0

Try this: view.popup.on("trigger-action", function(evt){ if(evt.action.id === "actionA"){ doSomething(); } else if(evt.action.id === "actionB"){ doSomethingElse()...
user avatar
  • 86
2 votes

How to retrieve data from a related table by using ArcGIS JavaScript API 4.1?

As of now, there isn't a direct API functionality in ArcGIS JavaScript 4.1 that you can use to retrieve a related table, not yet at least, it is coming soon according to Esri. The release from API 3....
user avatar
  • 11.9k

Only top scored, non community-wiki answers of a minimum length are eligible