[GIS] MapBasic Create Circle Round a Point

mapbasic

I've been tasked with creating a simple MapBasic plug-in that will loop through a table in MapInfo, zoom to the location of each point, create a circle to highlight the point, and convert the map to JPEG.

I've got all the steps working except the loop (I'll post a separate question for that) and the creating a circle. This is the code I use for outputting a single JPEG;

levelOfZoom = 2
circRad = (levelOfZoom / 10)
Select * from TabName where StructureNo = sName Into Zoomtable
Set Map  Center (Zoomtable.Easting, Zoomtable.Northing)
east = Zoomtable.Easting
north = Zoomtable.Northing
Add Map layer Zoomtable
Insert Into Zoomtable (obj) 
Values(CreateCircle(east, north, circRad))      
Close Table Zoomtable
Close Table Selection

Set Map  Zoom levelOfZoom Units "km"
Save Window my_window_id As "U:\MapInfoOutputs\"+sName+" at "+levelOfZoom+"km.JPG" Type "JPEG" Width 5.20833 Units "in" Height 3.75 Units "in" Resolution 128

I'm getting a 'Zoomtable is read-only' error when I try and execute.
If I change the

Insert Into Zoomtable (obj)
Values(CreateCircle(east, north, circRad))

To;

Update Zoomtable set
obj= CreateCircle(east, north, circRad)

It creates the circle, but replaces the original point. I need the original point to show with the circle round it to highlight it.
Also, the circles need to be removed once the jpeg has been created, I'm not sure how to do this, but having a map with

Best Answer

I would place the circle object (polygon) in a new layer using your insert code. Then you have your points and polygons separated. Instead of creating an circle you could also use the Buffer function in MapBasic.

Related Question