Skip To Content

esri_webfeaturelayer_add (AutoLISP)

The esri_webfeaturelayer_add function adds a new web feature layer with an optional filtering query. Resulting features within the project area will be drawn. If the web layer being added is secure, the user will be prompted to provide credentials as required by the portal.

Syntax

(esri_webfeaturelayer_add url [service_properties])

Arguments

The following arguments are included:

  • url | string | required | URL of a valid web feature layer to add to the drawing.
  • service_properties | associated list | optional | An associated list of web feature layer properties as dotted pairs as defined in the following table:

Associated labelValue typeValue descriptionRequired or optional
"DEFINITIONEXPRESSION"

String

A WHERE clause expression that limits features from the layer by attribute values. The syntax of the WHERE clause is determined by the source data.

Optional

"BRANCH"

String

The name of a branch version available on the web feature layer.

Optional

Example usage 1

Add the USA Major Cities web feature layer where the FID field value is greater than 3800:

(esri_webfeaturelayer_add "https://www.arcgis.com/home/item.html?id=85d0ca4ea1ca4b9abf0c51b9bd34de2e"
(list (cons "DEFINITIONEXPRESSION" "FID > 3800")))

Result example usage 1

Adds the USA Major Cities web feature layer and draws features within the current project area where the FID field value is greater than 3800 and the function returns a list of true:

(T)

Example usage 2

Add the USA States Generalized Boundaries web feature layer and features when the STATE_NAME field value starts with the letter N:

(esri_webfeaturelayer_add "https://esri.maps.arcgis.com/home/item.html?id=8c2d6d7df8fa4142b0a1211c8dd66903"
(list (cons "DEFINITIONEXPRESSION" "STATE_NAME LIKE \'N%\'")))

Result example usage 2

Adds the USA States Generalized Boundaries web feature layer, draws features within the project area when the STATE_NAME field value starts with the letter N, and returns a list of true:

(T)

Example usage 3

Add all PoolPermits web feature layers without any filtering query:

(esri_webfeaturelayer_add "http://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer")

Result example usage 3

Adds the PoolPermits web feature layer, draws all features within the project area, and returns a list of true:

(T)

Example usage 4

Add the editor01.triangle branch of the DamageAssessment web feature layer when the FID field value is greater than 3800:

(esri_webfeaturelayer_add "https://sampleserver7.arcgisonline.com/server/rest/services/DamageAssessment/FeatureServer"
    (list 
        (cons "DEFINITIONEXPRESSION" "FID > 3800")
        (cons "BRANCH" "editor01.triangle") 
    )
)

Result example usage 4

Adds the editor01.triangle branch of the DamageAssessment web feature layer when the FID field value is greater than 3800, and returns a list of true:

(T)

Return values

The following are the possible return values:

  • If successful, the function returns a list of true: (T).
    Note:
    Software asynchronous behavior:

    If the provided URL can be interpreted, it will return (T) even though the service is not fully added. It will return (T) before the features have completed drawing. A return value of (nil) typically means the service did not connect.

  • If failed, it returns a list with the first value of nil and an associated list containing the key value "Error" and an associated error message as a string: (nil ("Error" . "<message>")), or only (nil).

Failed return values

A failed return value can occur for any of the following reasons:

  • (nil ("Error" . "Invalid URL"))

    The URL provided is invalid.

  • (nil ("Error" . "Error"))

    The URL provided is invalid.

  • (nil ("Error" . "Missing required argument."))

    One or more of the required arguments was not supplied.

See also

(esri_docfeaturelayer_add)—An AutoLISP function that adds a new document feature layer.

(esri_weblayer_add)—An AutoLISP function that adds a new web layer, imagery layer, map imagery layer, or web feature layer.