HOW TO
The script in this article shows how use images to make my own palette in ArcView.
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
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
Article ID:000004192
Get help from ArcGIS experts
Download the Esri Support App