VECGetField and VECGetFieldCount

Demonstrates how to retrieve attributes of a particular shape in a vector layer.

Remarks

This example illustrates how to retrieve the attributes values of all entries in a vector layer.

Code

 local integer shape, integer layer, integer count, integer field
 local integer tfid, integer i
 
 tfid = DBOpen( GetPCIHOME() + "/demo/irvine.pix", "r")

 layer = 31

 count = VECGetFieldCount(tfid, layer)

 shape = VECNextShape(tfid, layer, -1)
 While shape <> -1
    print
    print "Shape ", shape

    for i = 1 to count 
            local string fieldname
            local string fieldtype
            fieldname = VECGetFieldName(tfid, layer, i)
            fieldtype = VECGetFieldType(tfid, layer, i)

            ! List any countedint arrays

            If fieldtype = "CountedInt" Then
               local  integer j
               local integer ptr intarray

               intarray = VECGetField(tfid, layer, shape, i)

               Print fieldname
               Print " Start:"
               Print " No. Items = ", F$len(intarray)
               For j = 1 To F$len(intarray)
                   Print " ", j, " = ", intarray(j)
               endfor
               Print " End:"
            Else
               Print fieldname, " = ", VECGetField(tfid, layer, shape, i)
            EndIf
    endfor

    shape = VECNextShape(tfid, layer, shape)
 endwhile

 Call DBClose(tfid)

Output

Shape 280
AREA = 70200
PERIMETER = 1140
LULC# = 280
LULC-ID = 261
ATTRIBUTE = 12
GROUP = 0
ArcIdList
 Start:
 No. Items = 2
 1 = 629
 2 = 630
 End:

Shape 281
AREA = 234000
PERIMETER = 2820
LULC# = 281
LULC-ID = 270
ATTRIBUTE = 12
GROUP = 0
ArcIdList
 Start:
 No. Items = 5
 1 = 617
 2 = 626
 3 = 638
 4 = 650
 5 = 651
 End:
 ...

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.