English

How To: Create a palette file with images as custom markers via Avenue

Summary

The script in this article shows how use images to make my own palette in ArcView.

Procedure

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Copy the following code into the new window:

    Code:
    '-- Create a FileDialog that returns image
    '-- types that can be used as icons
    aList =
    FileDialog.ReturnFiles({"*.xbm","*.mcp","*.bmp","*.rs","*.nbi","*.gif","*.tif"},
    {"X-Bitmap (*.xbm)","Macpaint (*.mcp)","WindowsDib (*.bmp)",
    "SunRaster (*.rs)", "Nexpert Object Image (*.nbi)","Gif (*.gif)",
    "Tiff (*.tif)"}, "Pick your icons to be markers",2)

    '-- Exit program if alist is empty
    If (alist.IsEmpty) Then
    MsgBox.Error("No selection made","Exiting")
    Return nil
    End

    '-- Make a list to place icons into
    aListA = {}

    '-- Loop to place above objects of above lists
    '-- into files and then make icons
    For Each i in alist
    anIcon = Icon.Make(i)
    aListA.Insert(anIcon)
    End

    '-- Make another list
    alist2 = {}

    '-- Make a marker of the icon
    For Each i in alistA
    aBM = BasicMarker.Make
    aBM.SetStyle(#BASICMARKER_STYLE_ICON)
    aBM.SetIcon(i)
    alist2.Add(aBM)
    End

    '-- Create symbollist
    aSymList = SymbolList.FromList(alist2)

    '-- Create a palette
    aPalette = Palette.Make
    aPalette.SetList(#PALETTE_LIST_MARKER,aSymList)

    '-- Create file
    aFileName = FileName.Make("$HOME").MakeTmp("marker","avp")
    anODB = FileDialog.Put(aFileName,"*.avp","Save Marker Palette As")

    '-- Exit script if user cancels file creation process
    If (anODB.GetName.IsNull) Then
    MsgBox.Warning("No Selection Made","Exiting")
    Return nil
    end

    '-- Create odb object and add anODB to it
    anODBavp = ODB.Make(anODB)

    '-- Add palette to odb file and then commit it
    anODBavp.Add(aPalette)
    anODBavp.Commit

  3. Click the Compile button.
    [O-Image] Script compile button
  4. Click the Run button.
    [O-Image] Run compiled script button
    Note:
    The image file must be in one of the following formats:
    .gif
    .mcp - MacPaint
    .bmp - Windows bitmap
    .rs - Sun Rasterfile
    .tif - Tag Image File Format
    .xbm - X Bitmap