VECQueryRect

Description

Demonstrates how to query for the shape ids within a specified 2D rectangle.

Remarks

Extract a list of all roads that fall within a five kilometer square of a given point, and print their names.

Code

 local int ptr road_list 
 local Vertex lower_left, Vertex upper_right
 local int i, int segment_num, int tfid

 lower_left.x = 432608.000 - 2500
 lower_left.y = 3725824.000 - 2500
 upper_right.x = 432608.000 + 2500
 upper_right.y = 3725824.000 + 2500

 segment_num = 25
 printf "Center point 432608E and 3725824 N\n"
 try
    tfid = DBOpen(GetPCIHOME()+"/demo/irvine.pix", "r")
    road_list = VECQueryRect( tfid, segment_num, lower_left, upper_right )
    for i = 1 to f$len(road_list)
        printf "Road with shape number %d and shape id %d within 5 km.\n", \
                road_list(i), VECGetField(tfid, segment_num, road_list(i), 1)
    endfor
    call DBClose( tfid)
    call EFree( road_list )
 onerror
    print "Error: ", GetLastErrorMessage()
 endonerror


Output

 Center point 432608E and 3725824 N
 Road with shape number 133 and shape id 1700210 within 5 km.
 Road with shape number 134 and shape id 1700210 within 5 km.
 ...

See also

DBClose()

DBOpen()

VECQueryRect()

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