Skip to main content
5 votes
Accepted

Regex expression in mapinfo sql to remove special character

I searched for "mapbasic regex" and found what looks to be what you may need posted in the nyalldawson.net blog: If you’re not familiar with regular expressions, they’re an extremely powerful ...
PolyGeo's user avatar
  • 65.4k
4 votes
Accepted

Update Column to a Value

Sometimes packing the tables used helps. This is especially a problem when you are updating one table with values from another table. You can also try to do it via the interface with the MapBasic ...
Peter Horsbøll Møller's user avatar
4 votes
Accepted

replace character in string in mapbasic

Unfortunately, there is no built in 'search & replace' functionality in the MapBasic language. The way I've always done this is to use a custom function and include this in any projects where I've ...
T_Bacon's user avatar
  • 2,203
4 votes

MapInfo 12.5 or 16 writing scripts

Sure, if you run MapInfo from the command line with the -server parameter then MapInfo will run in the background with no splash-screen and no application window. You can then run your MBX on this ...
T_Bacon's user avatar
  • 2,203
3 votes
Accepted

Create polyline using MapBasic (unknown number of nodes)

I don't think you need to create the PLine object explicitly, you'll be pleased to hear it's much simpler than that. Use the ToolButton as you have set up in your first code example and set the ...
T_Bacon's user avatar
  • 2,203
3 votes
Accepted

MapInfo/MapBasic SQL query

You will have create a copy of your table to be able to join these. Once you have made the copy, try running this query: Select * From MYTABLE, MYTABLE_COPY Where MYTABLE.OBJ Intersects MYTABLE_COPY....
Peter Horsbøll Møller's user avatar
3 votes

Mapbasic Code - Change Symbol Style Basic on Column Content

all you need to do really is use a Symbol object instead of Pen dim newSymb, currSymb as Symbol, symColour,symShape,symSize as Integer set the values for each integer variable in a Do-Case block as ...
Alex's user avatar
  • 479
3 votes
Accepted

MapBasic centroid in EPSG:28354

You need to specify the coordinate system to use before extracting the coordinates from the object: Commit Table DCDB As "C:\DCDB_Full_Copy.TAB" TYPE NATIVE Charset "WindowsLatin1" CoordSys ...
Peter Horsbøll Møller's user avatar
3 votes

Use Windows function GetProductInfo via MapBasic

I have successfully implemented this solution. Based on that I have created .NET assembly (*.dll). After that all you need is to declare the method in your MapBasic application: Declare Method ...
sys49152's user avatar
  • 1,715
3 votes

Show MapBasic Window equivalent in QGIS, e.g. Python Window

You can view a python window. I would suggest referencing this page QGIS Python console The QGIS Python Console is an interactive shell for the python command executions. It also has a python file ...
whyzar's user avatar
  • 12.1k
3 votes
Accepted

MapBasic IDE Switch from Code view to Design view

The designer in the IDE simply allows you to autogenerate the code based on a visual layout, it isn't capable of reverse engineering the code into a layout. There is an option to save a layout to file ...
T_Bacon's user avatar
  • 2,203
3 votes
Accepted

Find Raster data in a Mapinfo workspace

You'll have to loop through the layers in your map and check the type of each. mapwindowid = FrontWindow() For layerid = MapperInfo( mapwindowid, MAPPER_INFO_LAYERS) To 1 Step -1 if LayerInfo( ...
Peter Horsbøll Møller's user avatar
2 votes

Update Column to a Value

Check if you have non-objects in a table. select * from Limited_Stratum where not Obj into selection
sys49152's user avatar
  • 1,715
2 votes

Getting Started with MapBasic?

Sorry for digging out an old thread, but the MapBasic UserGuide and MapBasic Reference are probably the 2 best resources for getting started with MapBasic. I myself started off simply observing code ...
Sancarn's user avatar
  • 131
2 votes
Accepted

One to many join mapbasic

You should be able to do this using a standard join in MapInfo Pro: In the MapBasic window you'd run a query like this: Select * From PARCELS, OWNERS Where PARCELS.LOTPLAN = OWNERS.LOTPLAN This ...
Peter Horsbøll Møller's user avatar
2 votes
Accepted

Split polyline every Xm in MapBasic

In order to make the feature from Routeware's Toolbox run in MapInfo Pro 64 bit, you need to remove all references to the 32 bit DLL from the source code. Instead of removing all these features it's ...
Peter Horsbøll Møller's user avatar
2 votes

Split polyline every Xm in MapBasic

Install RouteWare Toolbox 1.07 a free addon for MapInfo http://www.routeware.dk/toolbox.php And just use "Split Line" tool and specify a distance. Simple as that. It will create a table with ...
sys49152's user avatar
  • 1,715
2 votes

Changing format of column from character to decimal or float in Mapinfo

This might depend on your regional settings. English/US regional settings are using . as decimal separator and , as digit grouping separator. Their numbers would look like this: 1,234,567.90 Many ...
Peter Horsbøll Møller's user avatar
2 votes
Accepted

How to reuse code with a few inputs each time in mapbasic (sub or function)?

Just dump your code into a sub procedure but remove the assignment of the two string variables strFieldName and strOutTable. These should be passed to the procedure as parameters. Also, any other ...
T_Bacon's user avatar
  • 2,203
2 votes

MapBasic: syntax to move a point?

My suggestion is very similar to @T_Bacon's solution. I have implemented the recommendations that I gave in a comment to his answer. Sub Main '// Adding a new Toolbutton to the Drawing buttonpad ...
Peter Horsbøll Møller's user avatar
2 votes

Opening and saving multiple shapefiles as .tab files?

You need to look at a few MapBasic statements You need to loop as many times as you have files. Which method you want to use depends on how you have your list of files Do Until EOF() can be used if ...
Peter Horsbøll Møller's user avatar
2 votes
Accepted

Performing multiple selection using MapBasic?

You could take a slightly different approach with this. If you create a temporary table containing all your array values, let's call it RouteIDs, then you can use just one SQL select which may be more ...
T_Bacon's user avatar
  • 2,203
2 votes
Accepted

Mapbasic write and read csv into python tuple type structure

Why not open the CSV into a MapInfo table? Then you could easily read the data from the mapinfo table to achieve the output you want. Take a look at the Register Table command in the reference guide ...
T_Bacon's user avatar
  • 2,203
2 votes
Accepted

Mapbasic work in current directory

To get MBX path you should use command: ApplicationDirectory$(). This command returns string representing your MBX path. According to MapInfo Reference: "By calling the ApplicationDirectory$() ...
Kevin Malone's user avatar
2 votes

Mapbasic Error - Alter Object cannot operate on an unitialized object variable

An alternative to this approach, and a more efficient way to do this as MapInfo can deal with looping through the table internally, is to extract the style update code into a separate function which ...
T_Bacon's user avatar
  • 2,203
2 votes

Custom tool for Mapinfo

If you are looking for at dialog/window that stays on the screen but doesn't prevent you from working with your map and data, you need to build your dialog/window using a different development ...
Peter Horsbøll Møller's user avatar
2 votes
Accepted

Get code to run on every column in a table -Error "Could not find a public static method named ..." -Mapbasic 17

It is probably not working because you are passing it the alias variables acol and inColumn and it is expecting a string. Try storing the required parameters into a string variable and passing that to ...
T_Bacon's user avatar
  • 2,203
2 votes

Using MapBasic, is there a method to compress GeoTIFF after programatically creating the GeoTIFF?

Can you call batch files from MapBasic? I compress GeoTIFFs externally, using a command like the following: gdal_translate -co COMPRESS=JPEG -co JPEG_QUALITY=%QUALITY% -co PHOTOMETRIC=YCBCR -co TILED=...
rossnixon's user avatar
  • 528
1 vote

Opening and saving multiple shapefiles as .tab files?

If it doesn't need to be through mapbasic code? It can be achieved quite quickly and easily using ogr2ogr. The following.bat file will achieve what you want using ogr2ogr. Variables to set are ...
Cushen's user avatar
  • 3,197
1 vote

Mapbasic Code - Change Symbol Style Basic on Column Content

Something along these lines: Function ChangeSymbolColour (ByVal objTarget as Object, ByVal stringAttribute as String) as Object Dim newSymbol as Symbol Dim nColour as Integer '// check that the ...
Peter Horsbøll Møller's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible