7

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 Uncaught TypeError: Cannot read property 'lods' of null (because tiles have Levels of Detail). <!DOCTYPE html> <html> <head> <meta charset="...


6

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 jQuery was done loading removed the error and got everything working. Future Me revisiting this question - it seems that anything that uses AMD/Require-style ...


5

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/FeatureLayer", "esri/graphic", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "dojo/domReady!" ], function (Map, MapView, TileLayer, FeatureLayer, Graphic,...


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, property changes were handled with events. In 4.0, watching for property changes has become much easier. This is handled via the .watch(property, callback) method. ...


4

You can use identifyTask to configure the popupTemplate for each sublayer of your MapImageLayer. See the following sample: IdentifyTask JSAPI 4.0


4

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: 'container-div-id' }); Then, you do not want to add the widget to your MapView ui mapView.ui.add(layerList, "bottom-right");}); // <- don't do this ...


4

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.


3

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) { var graphics = response.results; graphics.forEach(function(graphic) { console.log(graphic); }); }); }); The benefit here over how ...


3

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 using js api 4.x : .esri-view-root { background-color:black; }


3

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 source of the BasemapGallery changes, then this can be handled by setting up a watch on the appropriate property. https://developers.arcgis.com/javascript/latest/...


3

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%; } </style>


3

Check out this code snippet/post: Importing GeoJSON data in ArcGIS Javascript maps function requestData() { var requestHandle = esriRequest({ url: "data/sample.json", callbackParamName: "jsoncallback" }); requestHandle.then(requestSucceeded, requestFailed); } function requestSucceeded(response, io) { //loop through the items and add to the ...


3

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 screenPoint = { x: event.x, y: event.y }; // Search for graphics at the clicked location view.hitTest(screenPoint).then(function (response) { if (...


3

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. var canvas = domClone.querySelector("canvas"); $printSection.appendChild(domClone); return view .takeScreenshot({ area: { ignorePadding: false ...


2

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: "51c67be4a5ea4da6948a40210ddfab1a" // use to be 022290763bc243bbb5329c879e1dbd3a }) }); Works as expected. As such it must be something to ...


2

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


2

You can try something like this: var fullExtent = null; for (var i = 0; i < features.length; i++) { if (!fullExtent) fullExtent = features[i].geometry.extent.clone(); else fullExtent.union(features[i].geometry.extent) } mapView.goTo(fullExtent).then(function () { if (!mapView.extent.contains(fullExtent)) mapView.zoom -=...


2

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.18 to 4.1 has left some functionality still to be made available. Description of FeatureTable from API 3.18 here You can check out the functionality matrix ...


2

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 reference (wkid 3857) are supported. If viewingMode is local, then only services with projected coordinate systems are supported. Only Tile layers with the ...


2

Okay, I found a good explanation on ESRI's website: https://developers.arcgis.com/javascript/3/jssamples/map_currentextent.html


2

It fails either because it can't find the popupTemplate in your feature layer. so you have to init the popupTemplate this way : layer.popupTemplate = {content: [{type: "attachments"}]}; or because of the typo in your content. You have written tpye instead of type


2

I have a good example as an answer to my own question. Each feature in results.features should have its own geometry. If you know that it is a polygon geometry, you can instantiate a new polygon like so: new Polygon{rings:feature.geometry.rings}). This is a valid graphic to add to a graphics layer.


2

You can convert the geoJson to Graphics and add them to the map pretty easily (you can probably even cast to FeatureLayer). Esri has created a nice library to convert between geojson and esri json format, it's called geojson-utils. I have used it in the past and it works pretty nicely. The following code worked for me: <!DOCTYPE html> <html> &...


2

The GitHub page linked below contains a clustering example for v4.x (this if from the above comments) https://github.com/nickcam/FlareClusterLayer


2

With version 4.3 there is not yet support for labeling in 2D. Labeling is only supported in 3D SceneViews so far. See the "Known Limitations" in https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#labelsVisible


2

You have to use hitTest for this type of interaction. There's a discussion on GeoNet that shows how to do this, using this code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="description" content="[Access features with click ...


2

When you access the allLayerViews collection immediately after instantiating the MapView, the layers didn't have a chance to load yet. You could set up a watch on the collection's length property which will execute when the length changes from 0 to 1. view.watch('allLayerViews.length', function () { console.log(view.allLayerViews.length); //outputs 1 }...


2

The WebGL is only available, as beta version, for 2D (MapView) and not for 3D (SceneView) You can see that in the ESRI documentation: Starting at version 4.5, you can render FeatureLayers with WebGL in 2D MapViews. [...] By default, FeatureLayer is rendered using Scalable Vector Graphics (SVG), which limits the number of features that can be displayed in ...


2

According to the doc https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#open you have to either specify -along with the location- the title and content to the popup, or the features of the selected point. this.view.popup.open({ location: this.view.center, title: 'foo', content: 'bar' }); or this.view.popup.open({ ...


2

Are you freezing the pan and zoom of the map so it doesn't move around? Maybe drag isn't the correct event to use. This is quick hack, but I was able to get it to work by using the pointer-move event. https://codepen.io/odoe/pen/vryXKo?editors=1000 view.on("click", (event) => { view.hitTest(event).then(({ results }) => { const graphic = ...


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