Questions tagged [mapbasic]

MapBasic is a programming language for the creation of additional tools and functionality for MapInfo Pro Desktop GIS

Filter by
Sorted by
Tagged with
9
votes
4answers
13k 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.
7
votes
3answers
6k 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
2answers
4k 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 ...
5
votes
2answers
10k 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
498 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 ...
4
votes
2answers
1k 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 ...
4
votes
1answer
1k views

How can I change region style in MapBasic

I've problem with my code in MapBasic for change region style in MapBasic. I've created voronoi and I want to select that voronoi and change the style of it to yellow border and no fill. I already ...
4
votes
1answer
318 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 ...
4
votes
1answer
468 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 ...
4
votes
1answer
545 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
723 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. ...
4
votes
1answer
2k 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 MapBasic....
3
votes
2answers
28k 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?
3
votes
3answers
834 views

Mapbasic cycle through directory of tab files

I want to cycle through a directory of .tab files and then run a process on the files. I found https://groups.google.com/forum/#!topic/mapinfo-l/reYENsRRziM but can't figure out how to define the path ...
3
votes
3answers
3k 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
2k 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 ...
3
votes
3answers
3k 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
1answer
215 views

Regex expression in mapinfo sql to remove special character

Is there a way to clean the values in the column to just have A-Z 0-9 and _ ? In python/regex I run def Alphanumeric(string): import re clean_string=re.sub(r'[^a-zA-Z0-9‌​_]', '', string) return ...
3
votes
3answers
2k 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
3answers
215 views

MapBasic Dialog Preserve command error: No active Dialog

I've hit an issue with using the Dialog Preserve command. I get the error message "Invalid Dialog preserve command. There is no active dialog". As far as I can tell I've followed the guidance provided ...
3
votes
1answer
7k 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 ...
3
votes
1answer
1k 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 ...
3
votes
1answer
1k 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.
3
votes
2answers
930 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
503 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 bBrushStylesArray()...
3
votes
2answers
2k 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
2answers
4k 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
992 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
830 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.
2
votes
1answer
684 views

Adding file name of mapinfo file into its attribute table using MapBasic?

I have a task where I need to take the file name (no extension) of a MapInfo file and place it into a new field within its attribute table. I would normally use Arcpy to do something similar, but I ...
2
votes
2answers
434 views

Mapbasic Code - Change Symbol Style Basic on Column Content

I wrote a piece of code a while ago for colouring lines depending on what was in a certain column. I struggled through it, but managed to get it to work. Now, I want to write a piece of code that will ...
2
votes
2answers
284 views

Split polyline every Xm in MapBasic

I need to split large contour polyine datasets every 100m to be used for tiling. It currently has each (25cm) contour as a single (very long) line that extends beyond the tile and impacts labeling etc....
2
votes
2answers
93 views

Changing Background Color of Selection Rows using MapBasic?

In MapInfo Pro 12.5, in the Browser window, selected rows (selected either by clicking rows with the mouse or via a query) are highlighted dark blue but running the same queries in a MapBasic program ...
2
votes
2answers
722 views

Alias variable in MapBasic

I'm having a bit of trouble with the Alias variable in MapBasic. In short, I have a table where I was to group by a specific column. Then I want to run through each unique value from the grouped table ...
2
votes
1answer
341 views

Interpolation code with MapBasic

I have drivetest data, and usually I do an interpolation using the values taken in the drive with their respective lat/long. I use natural neighbor. You can see an example attached. I am trying to ...
2
votes
2answers
1k 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 ...
2
votes
1answer
2k 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 ...
2
votes
1answer
874 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
1k 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 =...
2
votes
1answer
680 views

replace character in string in mapbasic

Is there an equivalent to python .replace in mapbasic? Something like search = search.replace(',', ' ') I have found the search and replace tool for mapinfo and it works well but I need something ...
2
votes
2answers
380 views

MapBasic: syntax to move a point?

I'm trying to write a tool that moves a selected point from its old location to wherever I click, but can't seem to find the code in the MapBasic user guide. Ideally, I would like to select an ...
2
votes
1answer
231 views

Use Windows function GetProductInfo via MapBasic

I develop a MapInfo-based GIS and I need to be able to determine the Windows OS of a given user. So far we have used a Windows function GetVersionEx (kernel32 library) to do this but the function ...
2
votes
1answer
1k views

MapBasic - Create a Table array based on a variable

I wanted to create a temporary table as per my variable. If i have a value of 10, it will create a table with 10 rows. How should i start my code in MapBasic?
2
votes
1answer
1k views

Creating site cells sectors in MapBasic for over 1000 records?

I am new to MapBasic and i need to learn to create the cells of a site in MapInfo using the MapBasic. i Used the below script i found in the Web, and it was for only single site I made automated it ...
2
votes
2answers
134 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

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 these ...
2
votes
2answers
641 views

How can i add style to Mapinfo table?

I used Mapbasic to create tables. I create only table's structure without any objects inside. How i want make styles for tables. I tried something like: Dim b1 As Brush, p1 As Pen b1 = Makebrush (1, ...
2
votes
2answers
2k views

Split polyline where it intersects with other lines in MapInfo

I have a polyline (bus route) which I want to split where it intersects with other lines (not polylines) I have created. I'm happy to initially do it manually to see how it works, although I would ...
2
votes
1answer
548 views

For Each loop over an Array in MapBasic?

.NET C# developer here. Trying to figure out MapBasic with the IDE for the first time. It's shall we say...a different experience to C# in Visual studio. I have a ButtonPad with a button that calls ...
2
votes
1answer
432 views

Adding nodes to a line by interval in MapInfo

I am a MapBasic beginner, and I just want a simple .mbx or tool that can add nodes to a line by interval (say every 50m). I don't really need it to have a start point or end point (or maybe it is ...