How to get fields of Dynamic Layer hosted by ArcGIS Server using JavaScript?
Solved! Go to Solution.
You can create a FeatureLayer object from the REST endpoint URL, and get the information from its fields collection after it loads:
const featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0"
});
featureLayer.when(function() {
featureLayer.fields.forEach(function(field) {
console.info(field.name + " ( type: " + field.type + ", alias: " + field.alias + " )");
});
});
featureLayer.load();
You can create a FeatureLayer object from the REST endpoint URL, and get the information from its fields collection after it loads:
const featureLayer = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0"
});
featureLayer.when(function() {
featureLayer.fields.forEach(function(field) {
console.info(field.name + " ( type: " + field.type + ", alias: " + field.alias + " )");
});
});
featureLayer.load();
Thanks.