How to get fields of Dynamic Layer hosted by ArcGIS Server using JavaScript?
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();
@JoelBennett
Thanks.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.