jps services
  • Home Page
  • GIS Training Courses
    • QGIS Training Courses
    • ArcGIS Training Courses
    • MapInfo Pro Training Courses >
      • MapBasic Training Course
  • About
  • Blog

A first look at MapBasic

21/10/2016

0 Comments

 
If you have used MapInfo then you are probably aware that there is a programming language available called MapBasic for development work.

You can now download MapBasic without charge from http://www.pbinsight.com/support/product-downloads/for/mapbasic.

​The MapBasic interface is not as sophisticated as say Visual Studio. For instance, there is no visual interface for creating dialogue boxes, buttons etc.  In fact the interface hasn’t really changed very much from the original version. However, there have been many upgrades to the functionality offered by MapBasic from a programmable view point.  These reflect improvements in MapInfo and the Windows operating system environment.
Picture
The above image shows the MapBasic interface when you first fire up the software. Most of the options are familiar if you have used Notepad or a similar product. Whilst the interface is minimal the underlying software program is very powerful.
Picture
If you are new to MapBasic I suggest you click on the Help tab and select Contents. This first page introduces MapBasic and also shows you what is covered by the help option. If you have never programmed before then you may not agree with the statement in this section that MapBasic is ‘an easy to use programming language.’ This statement applies more to how MapBasic compares with say  C++ or Pascal programming languages.

​Even if you have never programmed before, you should still be able to learn enough about MapBasic from the Help screens to achieve some success in automating common mapping requirements. Most features of the program have some code snippets explaining how to use them within the help section.
You will probably learn more about programming in MapBasic  by actually inputting some of this code into the MapBasic program interface and see how it performs within MapInfo Pro. Most instructors say that without actually typing it out and trying to make it work you will not learn how to program.  Merely reading code is not enough to learn a programming language.

With that  in mind you could try out some code with the Note statement.  The Note statement can be very helpful in finding errors within your code. If that doesn’t mean very much at this point don’t worry. You will in time!

Try inputting the following into the MapBasic window: -
​
                        Note "This is probably the most simple program you could write in the MapBasic language"


Picture
Then select Project – Compile Current File.

If there are no errors in your code you will be asked to name and save your program. Then re-select Project – Compile Current File and you will receive a confirmation message.
Picture
 Now you have successfully created an executeable file which displays a message in MapInfo. You can run this program either by double clicking on your file or by selecting Project – Run.

Picture
Whilst this example doesn’t have any specific use it does show you how to write some code, compile and execute it. Hopefully this may encourage you to looking at some more complex code samples and to continue to program in MapBasic.
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Joe Short BSc has been involved with various mapping solutions for over twenty years.  If you are considering implementing a GIS  or have ArcGIS Pro, MapInfo Pro or QGIS training requirements, jps services would be happy to be of assistance to your organisation. 

    Archives

    April 2020
    March 2020
    October 2019
    September 2019
    August 2019
    July 2019
    March 2019
    November 2018
    October 2018
    August 2018
    July 2018
    November 2017
    October 2017
    September 2017
    July 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    May 2016
    February 2016
    September 2015
    August 2015
    April 2015
    February 2015
    November 2014
    October 2014
    July 2014
    June 2014
    May 2014
    March 2014
    February 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    June 2013
    May 2013
    April 2013
    February 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012

    Categories

    All
    Arc Gis
    Arcview
    Autodesk
    Cad
    Gis Training
    Local Government
    Mapbasic
    Mapinfo
    Quantum Gis
    Relational Databases
    Saga Gis

    RSS Feed