I have a bunch of data points, each of them have a coordinate information (longitude, latitude).

I am using CreateCircle( x, y, radius) function to select points within a distance to the chosen point.

But I need to manually update the x, y (coordinate) information for each selection, which is impossible since I have thousands of points.

Does anyone know if there is a way to update the coordinate information in the CreateCircle function? Not manually typing it everytime?


You should be able to do this using the Distance Calculator tool. You can find it under Tools > Tool Manager, just check the 'Loaded' box and it will come up under your Tools menu. If I remember correctly you can search for objects from one table within a certain range of objects from another table.


You do this using a bit of MapBasic, a simple loop should suffice.


Dim xCoord, yCoord, radius as Float
    oPoint, oCircle as Object

    radius = 50     '// set your radius

    Fetch first from MyPointTable   '// get the first record from the point table
    Do While Not EOT(MyPointTable)  '// loop until the end of the table
        oPoint = MyPointTable.obj   '// get the point object

        '// get the coordinates
        xCoord = CentroidX(oPoint)
        yCoord = CentroidY(oPoint)

        '// create your circle
        oCircle = CreateCircle(xCoord, yCoord, radius)

        '// do your selection and any processing

        Fetch next from MyPointTable    '// get next record from the point table
  • Thanks T_Bacon! I am using your loop in Mapbasic to select my points. One more question is that, when I fetch the first record (A) from my table, I want to save the name of the first record (A) before select other points within radius (since eventually I want to build a corresponding table telling me which points fell into the circle of records A, B, C, D ....). How can I grab the information of record A? I am new to the Mapinfo, thanks for the help! – BBQ Apr 12 '16 at 0:51
  • 1
    @BoqianJiang you can grab info from any field in much the same way as the point object in the code above. You need to make sure that you're storing the information in a variable of an appropriate data type, but it's as simple as: intUID = MyPointTable.UniqueID where MyPointTable is the table name and UniqueID is the field name that you want the data from. – T_Bacon Apr 12 '16 at 7:38
  • thanks! I am already done with what I wanted to do. Appreciate your help! – BBQ Apr 14 '16 at 2:11

Would a circular buffer work? It will not be a perfect circle, but you could set the segment count high, something like 60, then run buffers if they are the same radius for each of the points, and create a buffer for each of the points rather than combining the results.

You could also create another field in your data point table calling it radius. It will have to be an integer though, you could then fill in that field of the points you wish to have the buffers (circles) generated from using the values you input into that field.

I would have to see more of what you are trying to accomplish to help you in greater detail.

  • Hi jbgramm, thanks for your suggestions. I think T_Bacon's answer above gives a more convenient way at this point. I'll try his method first. :) – BBQ Apr 12 '16 at 0:53
  • I agree, that is why I upvoted the answer, and his comment to your second question. – jbgramm Apr 12 '16 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.