Skip To Content

esri_featurelayer_share (AutoLISP)

This function creates a hosted feature layer from one or more valid specified document feature layers. The specified document feature layer definitions and features are removed from the drawing, and the resulting features in the current project area are added to the drawing on the appropriate AutoCAD layers of the new web feature layers. The following are the usage requirements and behaviors:

  • The user must be signed in to the specified organization and have a sufficient user role to create or publish data.
  • A single hosted feature layer item containing one or more feature layers is created from the specified document feature layers.
  • If successful, each document feature layer is replaced by a web feature layer from the new hosted feature layer.
  • As with all web feature layers, only feature entities included in the current project area are redrawn in the drawing session.
  • The resulting feature geometry is limited to the capabilities of the hosted feature layer, which may alter geometry such as tessellating curves.
  • If you are not already signed in to an organization, you are prompted to enter your username and password.

Syntax

(esri_featurelayer_share sname flnames url [host_settings])

Arguments

  • sname | string | required | The new hosted feature layer name. The name will be truncated to 90 characters.
  • flnames | string | required | A comma-separated string of the document feature layer names to be shared.
  • url | string | required | The URL of the ArcGIS Online or ArcGIS Enterprise organization where the hosted feature layer item will be created.
  • host_settings | associated List | optional | A list of optional settings as dotted pairs to limit fields and return appropriate default values.

    Associated labelValue typeValue descriptionRequired/Optional
    "Description"

    string

    A description of the new hosted feature layer being created.

    Optional

    "TAGS"

    string

    A single string containing a comma-separated list of descriptive tags for the new feature layer.

    Optional

    "Folder"

    string

    The name of folder where the new hosted feature layer will be created.

    Optional

    "ShareWithEveryone"

    Boolean

    A true T or false nil value that specifies whether to share the new hosted feature layer with everyone.

    Optional

    "ShareWithOrg"

    Boolean

    A true T or false nil value that specifies whether to share the new feature layer with members of the organization.

    Optional

    "DisableEditorTracking"

    Boolean

    A true T or false nil value that specifies whether editor tracking will be disabled on the new feature layer.

    Optional

    "DefaultZ"

    double

    The default z-value for new features in editing applications that do not support the editing of z-values. This value does not apply when editing in ArcGIS for AutoCAD, which does support editing of z-values.

    Optional

    "GroupsToShareWith"

    string

    A single string containing a comma-separated list of the organization's group names to share with.

    Optional

Example usage

Attempt to share the Sample_Points and Service_Lines document feature layers as hosted feature layers within a new hosted feature layer item named New Construction:

(esri_featurelayer_share "New_Construction" "Sample_Points,Service_Lines" "https://www.arcgis.com"
  (list 
   (cons "Tags" "tag1,tag2")
   (cons "Description" "Owner")
   (cons "Folder" "String")
   (cons "ShareWithEveryone" nil)
   (cons "ShareWithOrg" T)
   (cons "DisableEditorTracking" nil)
   (cons "DefaultZ" 0)
   (cons "GroupsToShareWith" "group1,group2")
  )
)

Result example usage

Share the Sample_Points and Service_Lines document feature layers as hosted feature layers within a new hosted feature layer item named New Construction. A series of status messages are reported to the command line. Web feature layers are added to the drawing and entities are redrawn within the project area, and the function 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)
  • If failed, it returns a list with the first value of nil and then an associated list containing the key value "Error" and an associated error message as a string: (nil ("Error" . "<message>")).

Failed return values

Failed return values can occur for any of the following reasons:

  • (nil ("Error" . "Document feature layer not found."))

    The specified feature layer value is not a valid feature layer in the drawing.

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

    The URL provided is invalid.

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

    One of the required arguments was not supplied.

  • (nil ("Error" . "Only unique feature layers can be specified."))

    The same document feature layer is included more than once.

  • (nil ("Error" . "User does not have the sufficient capabilities to share as a Web Feature Layer."))

    You don't have adequate permissions. The organizational account needs to be at least a publisher role.

  • (nil ("Error" . "Service name is invalid or already exists."))

    Service name provided is invalid or already exists.

  • (nil ("Error" . "Incorrect user name or password."))

    Confirm that the URL to ArcGIS Online or ArcGIS Enterprise is reachable over the web.

  • (nil ("Error" . "An error occured"))

    Various possible issues are detected with connection and publishing.

  • (nil ("Error" . "No coordinate system set"))

    You must have an assigned coordinate system for the drawing.

  • (nil ("Error" . "One or more layers were not shareable."))

    One or more of the layers specified aren't shareable. For example, if they are annotation or multipatch, the entities can't be opened (locked AutoCAD layer).