0

Can someone please provide an example to show how this would work.

For example, I am trying to convert from .GRD to .ASC, would my MapBasic code look like this:

public void Convert(string "C:\Users\file1.grd", string "C:\Users\Converted", string ESRI ASCII and Float grids)
{
    RasterProcessing.Convert(string "C:\Users\file1.grd", string "C:\Users\Converted", ESRI ASCII and Float grids);
}

Clearly I am doing something wrong here as I get unrecognized command error from MapInfo.

Could someone please explain how to rectify this.

I have looked at a similar post here: mapbasic convert raster to mrr

but was not able to find success. I tried the manual too and I wasnt sure how to address the parameters.

Edit:

I am really new to coding in general. I was under the impression that this code needed to be input into the MapBasic window to run. I tried editing the code to something like this but it failed:

Dim strInFilePath as string
strInFilePath = "C:\New folder\trial.grd"
Dim strOutFilePath as string
strOutFilePath = strInFilePath
Dim strDriver as string
strDriver = "ESRI ASCII and Float grids (*.asc)"

public void Convert(strInFilePath, strOutFilePath, strDriver)
{
RasterProcessing.Convert(strInFilePath, strOutFilePath, strDriver)
}
4
  • Based on the link you shared it looks like you should be using .NET to do this (either C# or VB) rather than MapBasic.
    – T_Bacon
    Apr 16, 2018 at 7:28
  • Hi, I changed my code, I was under the impression that this code needed to be put into the MapBasic window? How do I launch raster processing codes? Sorry I am very new to all this and any guidance is appreciated :) Apr 18, 2018 at 1:39
  • If you follow the link you posted, the accepted answer explains where you can find example code along with the documentation. I would start there if I was you. I'm fairly certain you will need to compile your code so it won't be able to be run directly from the MapBasic window anyway.
    – T_Bacon
    Apr 18, 2018 at 7:23
  • Alright I will try my best, thanks. Will post up a solution here if I figure it out. Apr 23, 2018 at 4:25

1 Answer 1

1

If you have MapInfo Pro Advanced,licensed or a trial version, there is a tool called Export. It allows to export a .grd raster to an Esri ASCII grid. It can be found under Raster tab->Raster Operations->Utilities->Export. Or by simply searching "export" in the quick search tool.

1
  • Its fine, I ended up using QGIS to do this. The MapInfo tools generally have no batch processing ability and are very difficult to code for. Myself and my organisation have completely switched away from MapInfo in favour of QGIS. Jul 21, 2020 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.