Skip To Content

WebLayer.AddAsync (.NET)

The WebLayer.AddAsync method adds a new map layer, imagery layer, or web feature layer to the drawing using the specified URL. This method consolidates MapLayer.AddAsync and WebFeatureLayer.AddAsync into one method. You can add all the feature layers from a feature service or specify the URL of a specific layer in a feature service.

Declaration

public async Task<bool> Esri.ArcGISForAutoCAD.WebLayer.AddAsync(Document doc, string url)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

url

The URL of a valid web layer that will be added to the drawing.

required

Returns

TypeDescription

bool

true if the web layer was added successfully

Remarks on error conditions

This method may throw an exception or return false or null if a parameter is invalid.

Example

Print the success of adding the web feature layers from the designated feature server to the drawing.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer";

// Add the web feature layers
var success = await Esri.ArcGISForAutoCAD.WebLayer.AddAsync(doc, url);

// Print the success
doc.Editor.WriteMessage(success.ToString());

/* Example output
True
*/

See also

WebFeatureLayer.AddAsync —A .NET method that adds a new web feature layer with an optional filtering query.

MapLayer.AddAsync—A .NET method that adds a map or imagery layer to the current drawing using the specified service properties.

esri_weblayer_add—An AutoLISP function that adds a map or imagery layer to the current drawing using the specified service properties asynchronously.