VERIFIED SOLUTION i
X

How to create a New Table and Create Points using the MapBasic Window

UPDATED: August 2, 2017


How to create a New Table and and Create Points using the MapBasic Window


Follow these steps for this example:

1) In MapInfo Pro 64 bit Select > Home Tool Window > MapBasic

2) Click Inside the MapBasic Window and type the following from the example below:


'Following line below creates a new table with the following structure: character field with two float fields. 

create table bob (MattID char(30), x Float, y Float) file "c:\bob.tab" type native

'This line creates a Map window for the table created.

Create Map For bob

'These insert statements create two records with two point objects into the table.

insert into bob (MattID, obj) values ("Kevin" , createpoint (-73.4598, 42.32498))

insert into bob (MattID, obj) values ("Greg" , createpoint (-74.569, 48.235))

'After inserting the records and creating the objects in the table, this statement updates the x,y field with the coordinates information

Update bob  Set x =centroidx(obj), y = CentroidY(Obj)Browse * From bob

' The following statement below views the entire map of the points.

Map From bob 

Set Map Zoom Entire

--------------------------------------------------------------------


User-added image

Environment Details

Products Affected: MapBasic™, MapInfo Pro™

Downloads

  • No Downloads