MapBasic is a programming language for creation of additional tools and functionality for the MapInfo geographical information system.

learn more… | top users | synonyms

6
votes
2answers
1k views

Converting MapInfo TAB to GeoJSON

Is there an easy way to convert MapInfo TAB files into GeoJSON? I am working on a web-based mapping system which will use GeoJSON to transfer data. I also use MapInfo and would like to be able to ...
5
votes
3answers
5k views

Getting Started with MapBasic?

I am new to MapBasic. I googled for tutorials and found various PDFs but could not get started with the resources. I would be glad if anyone could provide some path for learning MapBasic.
5
votes
2answers
4k views

Easy way to Create Vector Grid polygons?

We're currently using MapInfo & MapBasic to analyze daily tests results for planning purposes.For each test,exported result may contain empty values (say 999,we know Mapinfo has no NULL values),so ...
4
votes
2answers
2k views

How to select distinct values from a column in Mapbasic?

I have a table in a mapinfo .tab file. Is there any way to select distinct values from the column? I tried :- SELECT distinct (some_column) from table_name into temp_table But this query would ...
4
votes
1answer
324 views

Copy text to clipboard with MapBasic

I think the title says it all - is it possible to programmatically copy/paste some text to/from the windows clipboard using MapBasic? I have found this discussion but it only discusses copying and as ...
4
votes
2answers
329 views

How do I snip/split polylines at chainages?

What is the best way to snip/split lines at chainages? E.g I have a csv with the uniq ID of the polyline item and a start and end chainage. I want to extract the lines between the chainages stated. ...
3
votes
3answers
2k views

Create closest-distance line in MapInfo

As part of a larger program (basically a remake and extension of DistanceCalc) I want to programmatically create a line between the two closest points of two regions in MapInfo. The ObjectDistance ...
3
votes
2answers
237 views

How to write an equivalent to MapBasic's CreateLine in pyQGIS?

I know this kind of question has been asked, in part, before - specifically: Seeing QGIS Python Commands and: How is object created as line using createline stored in .tab file? but this is a specific ...
3
votes
2answers
998 views

Check if an object is empty in mapbasic

I have mapbasic code that manipulates the obj-column in a point-table. Some rows doesn't have any geometry so the obj-column is empty. My question is how to check if there is no object? All the ...
3
votes
3answers
1k views

Definitions and limitations of MapInfo TAB file objects

I am working on a MapInfo plugin to convert MapInfo files to GeoJSON files. I am having trouble matching up the object types of the two formats. Each GeoJSON object type is described in the ...
3
votes
2answers
546 views

Create collection from selected objects

I have a table with a series of objects in it. Each record has a reference number but these numbers are NOT unique - e.g. there are two records with reference "01" and each of them has a different ...
3
votes
1answer
73 views

What are some GIS outlets for my open source MapBasic utility module and library?

I'm actively developing a MapBasic module that provides additional MBX programming functionality by wrapping .NET 4.0 and Win32 API calls in easy to use MapBasic functions and subs. MB_Utils acts as ...
3
votes
1answer
267 views

MultiListBox array error

I have created a MultiListBox control which is populated with a list of all currently loaded TAB file names in MapInfo. The user selections are then read from the MultiListBox and added to another ...
3
votes
2answers
489 views

Mouse unclick event in mapbasic?

How can I respond to mouse unclick in mapinfo using mapbasic? Is there any event triggered when the mouse in unclicked? For example at the end of drawing a line when the mouse button is released.
3
votes
1answer
695 views

How can I change object image in MapInfo using MapBasic?

I need to change the image of the objects which are in the Selection Table using MapBasic functions. When I say "Image" I mean point object icon on the map.
2
votes
2answers
2k views

Drawing a circle of a given area in MapInfo

I would like to draw a circle in MapInfo exactly 0.9Ha in area. I've done it by working out the corresponding radius should be, drawing a circle of arbitrary size, double clicking on it and then ...
2
votes
2answers
198 views

What is the difference between Sub and a Function in Mapbasic?

In MapBasic it seems like Functions can have side effects so I don't really see the difference between using the following: Declare Sub MyProcedure (myParameter As String) and then use myParameter ...
2
votes
2answers
8k views

Converting .kml file to .tab (Map info) format

If I have saved polygons as a (.kml) Google Earth File and I want to draw it in MapInfo, is there a tool to do this ? If not, how can be it be made using MapBasic?
2
votes
3answers
887 views

Fully automating a workspace to create maps with different file names but same information?

I have a lot of maps (over 600) to create. They all contain the same column titles and the layouts will be the same. I don't want to have to go through and repeat the same process everytime, I would ...
2
votes
1answer
591 views

Getting number of tables loaded with integrated mapping

I am integrating a MapInfo map into a form in an Access database. I am trying to find out the number of tables loaded but NumTables() and MapperInfo() are both getting "unrecognized command" errors. ...
2
votes
1answer
226 views

How to set ODBC connection in MapBasic

i am trying to set code for ODBC connection in Mapbasic. Instead of using Username and password i wanted to set code for Window authentication.my sample code is Register table "tablename" Type ODBC ...
2
votes
1answer
3k views

Creating polygons from points in Mapinfo

I have a huge number of points(co-ordinates), from which I am required to draw a polygon in Mapinfo. This required polygon is a square of 200m size. All I have now is the left side lower end of the ...
2
votes
3answers
436 views

Is it possible to retrieve thematic layer information for a Layer in Mapbasic?

I found this code windowinfo(FrontWindow(), WIN_INFO_CLONEWINDOW) This function gives information (mapbasic) about the front Map window which can be used to regenerate the map. Is there any ...
2
votes
1answer
880 views

How to draw lines of specified lengths in specified directions in Mapinfo?

I have an Excel file with the following data: 1) longitude and latitude which represents a point 2) Angle which represents where line turns from North 3) length of line. Is is possible to draw ...
2
votes
1answer
654 views

How to add custom Icon to buttons on buttonpads in mapinfo?

I have made buttons with icons availabe in mapinfo but now i want to add custom icon. Is it possible my code is as follows: Include "icons.def" Declare Sub Main Declare Sub button_prompt Sub ...
2
votes
1answer
47 views

Custom range value and colour thematic in mapbasic

I'm working on a tool to help my work. I managed to make a thematic, but the range of values and colors appear automatically. Here is the code: Dim fRangeLimitsArray() As Float Dim ...
2
votes
1answer
161 views

MapBasic sentence to update column contained in an object table

I was looking for a MapBasic sentence to update a MapInfo table. I've got two tables and I want to update one of them (POINTS) with an attribute of another (REGIONS). I would like to update points ...
2
votes
1answer
58 views

Expression does not evaluate to column or table name?

This is my code: Include "MAPBASIC.DEF" Include "MENU.DEF" Dim s_filename As String s_filename = FileOpenDlg("","","TAB"," Open Table Interactive") Browse * From s_filename I want to open a ...
2
votes
1answer
664 views

How to change the view of a map window in MapInfo to a new center coordinate?

How can I change the map view of a map window in MapInfo Professional to a new center coordinate? I need to change the viewed map in the MapInfo window via a predefined set of coordinates via ...
2
votes
2answers
468 views

How to convert the SQL result to an array?

I want to design a popupmenu And I use SQL to find the title I need but I need to convert the table to an array in order to use Title From Variable xxx
2
votes
1answer
92 views

Does mapbasic support function overloading?

I am creating application with mapbasic. Now that it's been some time with mapbasic I found that the language is very fundamental and does not support functionality that I took for granted in Java or ...
2
votes
1answer
2k views

Creating MBO files with MapBasic and Notepad++

[Note: I have been using Notepad++ (with some customisations as per this page), rather than MapBasic itself. This may make things a bit trickier, but so far the time saved in development has been ...
2
votes
0answers
66 views

String Size/Query in Mapbasic

I want to select many objects on the screen and select other objects that share the same attributes with the chosen group. So I'm creating a tool to select many object based in five tables' columns ...
1
vote
2answers
298 views

Setting custom valid values to a MapInfo field?

I was wondering if it was possible in MapInfo to set valid values for a field, e.g a field called material and only valid values being BIT, CON or STO? I have a basic knowledge of MapBasic. Thanks, ...
1
vote
2answers
646 views

How to add element to Mapbasic Array?

Code: Dim name_array() As String Redim name_array(10) How to add value to the array? I know we can add value by specifying index like name_array(i) = "some_value" But I don't want to specify ...
1
vote
2answers
2k views

What are the best ways to connect two coordinates on mapinfo?

I have with the help of this forum drawn a coordinate system with longitude and latitude at different location. I am trying to connect these sites what is the best way to connect. Is it just drawing ...
1
vote
1answer
879 views

Escaping spaces in paths for use in batch file

I am making a MapInfo program in MapBasic. I am calling OGR2OGR in order to convert some files. To do this I am generating a batch file and then running it. My code looks something like this: RunStr ...
1
vote
1answer
698 views

How to handle select query to return numeric value?

I have the following select Query : Dim count As Integer Select count(*) as mycount from some_table into temp_table Fetch First From temp_table count = some_table.mycount But it sends error: ...
1
vote
2answers
59 views

Trying to completely Exit from the Mapinfo application?

I tried the following two things: include "mapbasic.def" Declare Sub Main Declare Sub Exit Sub Main() If WindowInfo(WIN_MAPBASIC, WIN_INFO_OPEN) then Close Window WIN_MAPBASIC ...
1
vote
1answer
44 views

Dialog Table Name Prompt Error In MapBasic_Mapbasic

I am trying to prompt the Table name from the opened tables and to use it in the rest of the program, but what i get is (Table (i) is not open) after clicking ok the Sub Procedure is below, please ...
1
vote
1answer
34 views

Strange results

I am getting a strange error within GIS, when using the internal MapInfo Select query for objects. SELECT featurecode, area(obj,"sq km"),theme, DescriptiveGroup,count(*) from ...
1
vote
1answer
556 views

In MapBasic, how do you place a user selected string from a FileOpenDlg() statement into an EditText field for use by a sub procedure?

I have created a custom menu that displays a dialog box when clicked on. I have made the "Browse" button to call a FileOpenDlg() statement. I want the file that the user selects to populate in the ...
1
vote
1answer
177 views

Which version of mapbasic to use for maximum interoperability with different mapinfo versions?

The oldest mapbasic download offered by pbinsight these days seems to be version 9.5. I wonder can all subsequent versions of mapinfo run compiled code written with this? If so, is an older (and ...
1
vote
1answer
706 views

Is it possible to create Thematic Maps using two columns in Mapinfo?

I have created Thematic map with one column in Mapinfo. Is it possible to create Thematic Map using two columns in Mapinfo? For Example: I have a column with name of place and a column with date. ...
1
vote
1answer
80 views

Run the Sub procedure by selecting an object from the map

In Mapbasic made custom menu selected item to run sub procedure, what i want to make the Sub procedure to be ready to run by selecting an object from the map and run again by selecting another ...
1
vote
1answer
67 views

How can I make a dialog box floating while working on the window?

I would like to have a floating dialog box just like the Named Views.mbx How could make my existing dialog box float while working on other window? Thanks!
1
vote
1answer
150 views

What arguments does MapBasic's ColumnInfo() take?

MapBasic's tableInfo() function has a KnowledgeBase docs page here listing the arguments and all the attributes it takes, and a usage example in the reference document. columnInfo() has neither of ...
1
vote
1answer
805 views

How to loop through all columns in a table/layer getting all data for a row/feature in MapBasic?

I'm trying to extend this GNU-licensed plugin MI2SVG, which converts MapInfo maps to SVG, so that it writes associated table data into the SVG it creates, so that browser based JS web applications can ...
1
vote
2answers
284 views

Selecting an item with the mouse in MapBasic

This may seem relatively simple, but I'm pretty confused. I have written a mapbasic tool that does things to the table 'Selection' depending on user choices in a popup menu, but currently you need to ...
1
vote
1answer
334 views

Automatically updating a table column with the name of table

Does anyone know a straightforward way in MapBasic to automatically update a table column with the name of the table the column exists in? Going from the MapBasic reference guide it seems the ...