Geographic Information Systems in the Sciences
This page contains information about MapBasic
MapBasic programs:
- EXAMPLE1.mb: Map countries with > 5 million population
- EXAMPLE2.mb: Change Menu Bar
- EXAMPLE3.mb: Read x,y data from text file and put on map
- EXAMPLE4.mb: Read x,y,z data in columns from text file and put on map
- EXAMPLE5.mb: Read x,y,z data in grid (Excel) form from file and put on map
- GMT_VEC.mb: mb prog to plot vectors
- GMT_VEC_2.mb: mb prog to plot vectors (includes call to external subroutine)
- READ_EXCEL.BAS: subroutine to read a tab-delimited Excel grid file
- NEXTNUM.BAS: subroutine to parse an input line
- CONTOUR.BAS: subroutine to create MapInfo table of contour lines from gridded data
- ANIMATE.mb: MapBasic program showing use of animated layer
Some MapBasic tasks:
Creating a table and putting objects and columns into it:
'-- create table and define columns
create table table_name
(Height float)
'- make table mappable so objects can be inserted into it
create map for table_name
'-- create a rectangle object (or use 'create rect' command)
create region into variable tobj 1 4
(x-dx/2, y-dy/2) (x+dx/2, y-dy/2) (x+dx/2, y+dy/2) (x-dx/2, y+dy/2)
'-- t is some value to go into the table in the Height column
t = x-y
' -- insert into table
insert into table_name (Height, Obj) values (t, tobj)
'-- write out table
commit table table_name as "my_table"