Add Library layers to a View [SCRIPT]

Last Published: April 25, 2020



How do I properly bring in a Library layer using Avenue code?


The following script might assist you with bringing in your libraries from ARC/INFO Librarian as themes into ArcView. The online Avenue Help for SrcName.Make request gives an example of dot notation between the libraries. In the Help example, you must substitute your real library.layer names. If you are using variables for these "real" names, you will need to concatenate the
variables with the dot notation character, as follows.


You should have a View active in your project before running this script. You should also have libraries already setup for ArcView.
'------ Begin Script

theView = av.GetActiveDoc

'--- Retrieve your Librarian
theLList = Librarian.ReturnLibrarians
myLibrarian = MsgBox.List(theLList,"","")

'--- Retrieve your Library
aLib = myLibrarian.ReturnLibraries
myLibrary = MsgBox.List(aLib,"","")

'--- Or you can make your own library directly using ...
'--- myLibrary = Library.Make("your_library","ARC/INFO*LIBRARIAN")

'--- Check to see if you have a valid path set for the library you've chosen.
thepath = myLibrary.GetPath

'--- Choose a layer based on your previously-selected Library
theLayers = myLibrary.ReturnLayers
mylayer = Msgbox.List(theLayers,"","")

'--- Add the ARC/INFO*LIBRARIAN layer with polygon feature class
theSrc = SrcName.Make(myLibrary.AsString+"."+mylayer.AsString++"polygon")

'--- Create a theme from theSrc and add it to a View
aTheme = theme.Make(theSrc)

' aTheme.SetName("MyGreatLayer") '--- Optional

'------ End Script

Article ID:000001499

  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options