This sample is a modified 4.x version from the 3.x version linked here (https://developers.arcgis.com/javascript/3/jssamples/portal_addshapefile.html).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> | |
<title>ArcGIS JSAPI 4.6 TypeScript Demo</title> | |
<style> | |
html, | |
body, | |
#viewDiv { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Please go to the following jsbin for a working sample: https://jsbin.com/nejolahicu/1/edit?html,js,output | |
//Depending on server load, it may take awhile for the feature layer to load and be displayed on the map. | |
require([ | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/PopupTemplate", | |
"esri/layers/FeatureLayer", | |
"esri/widgets/Popup", | |
"esri/tasks/support/Query", | |
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.js", |
This modified sample is from the Custom WebGL layer (https://developers.arcgis.com/javascript/latest/sample-code/custom-gl-visuals/index.html#).
To make this work for a feature layer, I did the following....
- Created a feature layer class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
"esri/Map", | |
"esri/views/SceneView", | |
"esri/layers/FeatureLayer", | |
"dojo/domReady!" | |
], | |
function (Map, SceneView, FeatureLayer) { | |
// Code to create the map and view will go here | |
var featureLayer = new FeatureLayer({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Version using featurelayer query | |
require([ | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/layers/FeatureLayer", | |
"esri/tasks/support/Query", | |
"esri/tasks/QueryTask", | |
"dojo/domReady!" | |
], | |
function (Map, MapView, FeatureLayer, Query, QueryTask, SimpleFillSymbol, Renderer) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/layers/FeatureLayer", | |
"esri/tasks/support/Query", | |
"esri/tasks/QueryTask", | |
"esri/geometry/geometryEngineAsync", | |
"dojo/domReady!" | |
], | |
function (Map, MapView, FeatureLayer, Query, QueryTask, geometryEngineAsync) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Esri.ArcGISRuntime.Data; | |
using Esri.ArcGISRuntime.Mapping; | |
using Esri.ArcGISRuntime.Symbology; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Esri.ArcGISRuntime.Data; | |
using Esri.ArcGISRuntime.Geometry; | |
using Esri.ArcGISRuntime.Mapping; | |
using Esri.ArcGISRuntime.Symbology; | |
using Esri.ArcGISRuntime.UI; | |
using Esri.ArcGISRuntime.UI.Controls; | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(["esri/map", | |
"esri/layers/FeatureLayer", | |
"esri/tasks/query", | |
"esri/renderers/ClassBreaksRenderer", | |
"esri/symbols/SimpleMarkerSymbol", | |
"esri/Color", | |
"dojo/domReady!"], | |
function (Map, FeatureLayer, Query, ClassBreaksRenderer, SimpleMarkerSymbol, Color) { | |
var featureLayer = new FeatureLayer("url to feature layer", { |
NewerOlder