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
4k views

How do I get Started with MapBasic?

I am new to MapBasic. I googled for tutorials and found various pdf's but could not get started with the resources. I would be glad if anyone could provide some path for learning MapBasic.
5
votes
2answers
3k 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
1k 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
293 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 ...
3
votes
2answers
183 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
702 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
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
3answers
905 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
430 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
2answers
416 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
551 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
1k 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
102 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
5k 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
735 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
481 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
74 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
2k 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
383 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
719 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
482 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
457 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
1answer
204 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 ...
2
votes
2answers
399 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
82 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
1k 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
38 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 ...
2
votes
2answers
190 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. ...
1
vote
2answers
182 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
534 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
751 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
553 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
1answer
22 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
274 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
157 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
40 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
85 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
319 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
180 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
137 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 ...
1
vote
1answer
1k views

How to create a circular sector in Mapinfo?

I want to build a tool that creates a cell sector from data like that below. The sector diagram should be like the second picture. The first picture shows a Mapinfo tab file with the required fields ...
1
vote
3answers
996 views

Different in distance measurements in MapBasic/MapInfo

I am trying to make a custom ToolButton but I am having some problems getting correct measurements. I have drawn a line (using the normal line tool) and set its length to 1000m. (Double-clicking it ...
1
vote
1answer
210 views

What is the sequence of select query execution in Mapinfo?

I have confusion with the following query: Query 1: Select * from TABLE where vendor = "vendor1" OR "vendor2" OR "vendor3" ...
1
vote
1answer
528 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
856 views

Finding text object variable names in MapInfo/MapBasic

In MapBasic you can create a text object in a layout window by using the "Create text" statement. You can also use the same statement to update this object. I am working on a tool that creates ...
1
vote
1answer
69 views

How to select all unique values in a column and put it in multilist box?

I wanted to collect all unique values in a column and show it in multilist box.
1
vote
1answer
125 views

Mapinfo SQL Query for compare for edited data in tables

I have a table that contain several columns, each has their own data. then, someone have made some change in the data (just a little one data editing). how do i know later what data have been ...
1
vote
1answer
43 views

In MapBasic, how do I open a connection to MapMarker so I can allow my app to geocode?

I would like my app to open up MapMarker and automatically geocode for me. I cannot get past the Open Connection statement as I am receiving an error while compiling. Here is the code: Include ...