MapInfo Pro

 View Only
  • 1.  Raster SDK documentation and samples

    Posted 11-15-2020 22:05
    Hello,

    Is there Raster SDK document available to get started please?

    I mean, if I remember the good old vertical mapper, it had code samples and documentation.
    Is there such thing for Raster please?

    Ideally with mapbasic integration.

    Thanks

    ------------------------------
    Alban Spella-Barberet

    ------------------------------


  • 2.  RE: Raster SDK documentation and samples

    Employee
    Posted 11-16-2020 09:33

    Raster SDK API documentation and sample codes are present in the MapInfoPro installation directory at the following path.
    C:\Program Files\MapInfo\Professional\Raster\Documentation\API\.

    The 'MapInfoProRaster.NET_SDK.chm' file at this path contains the API documentation and the Sample Code folder contains the samples in C#.
    The samples does not contain mapbasic integration code as it is. But we can provide it based on the specific usecase.



    ------------------------------
    sujit thakur
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 3.  RE: Raster SDK documentation and samples

    Posted 11-16-2020 17:19
    Hello,

    Thanks. That's usefull. At the moment, I'd like to try to integrate raster into Mapbasic as I have a lot of scripts using mapbasic and vertical mapper.

    Below is a piece of code I'd lile to translate for Raster. That's using the contour function....

    ****************************
    Sub vmGRCContourSub

    Dim i_errCode As Integer

    Dim s_classifiedTableName As String
    Dim i_vmGrid As Integer

    s_classifiedTableName = "C:\temp\CIR1M__ProvPlot_18db_App1.tab"

    i_vmGrid = vmOpenGrid(s_classifiedTableName, 0)

    If i_vmGrid = 0 Then
    Goto ERR_VMOPENGRID
    End If

    Dim s_regionTableName As String

    s_regionTableName = "C:\temp\" + "CIR1M__ProvPlot_18db_App1_Contour.tab"

    i_errCode = vmGRCContour(i_vmGrid, s_regionTableName, 0)

    If i_errCode <> 0 Then
    Goto ERR_VMCALL
    End If

    i_errCode = vmCloseGrid(i_vmGrid)
    open table s_regionTableName as testfile
    map from testfile
    set map window frontwindow() zoom entire

    LAST_EXIT:
    Exit Sub
    ERR_VMOPENGRID:

    Note "Failed to open grid."
    Exit Sub
    ERR_VMCALL:
    Note "Call to vmGRCContour failed. Error code = " + Str$(i_errCode)
    i_errCode = vmCloseGrid(i_vmGrid)
    Exit Sub
    End Sub
    ******************

    The VM libraries are called using:
    ***********************

    'Set the current directory as the executable directory in order to access Vertical Mapper functionality
    g_AppDir = GetKeyValue(HKEY_LOCAL_MACHINE, "SOFTWARE\MapInfo\MapInfo\Vertical Mapper\370", "PATH")

    Call SetVMDirectory(g_AppDir)
    Call SetMBDirectory()

    ***************


    Would you have anything similar so I can get started with it please?
    Thanks in advance


    ------------------------------
    Alban Spella-Barberet
    NBN Co Limited
    North Sydney NSW
    ------------------------------



  • 4.  RE: Raster SDK documentation and samples

    Employee
    Posted 11-19-2020 06:55
      |   view attached

    RasterSDK API has more granular level customization option for different operation. Because of this it exposes more  parameters for the callers to configure. These parameters can be constructed easily in .Net.  
    The contouring task you are trying to run here can make use of the API RasterAnalysis.ClassifiedPolygonContour( ...) method.
    Since you wish to call this method from MapBasic, the easiest way is to create a .Net library ,say RasterMapBasicInterface.dll, that consumes raster Raster SDK API . We can set all relevant paramters in the RasterMapBasicInterface and call RasterAnalysis.ClassifiedPolygonContour( ...) method from inside RasterMapBasicInterface.
    On the Mapbasic side we can import methods of RasterMapBasicInterface and call them easily.

    I have attached the .Net interface dll and the MapBasic script here.
    Also attached the C# source code for reference.
    Any customization in the parameters passed can be done in the .Net Interface class .



    ------------------------------
    sujit thakur
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------

    Attachment(s)

    zip
    ClassifyContour.zip   306 KB 1 version


  • 5.  RE: Raster SDK documentation and samples

    Employee
    Posted 11-20-2020 04:19
    I have built a sample application that takes advantage of some of the raster capabilities in the Raster SDK.

    I have used the same approach as Sujit mentions by building the integration to the Raster SDK in C# and exposing this to MapBasic via an assembly.

    You can find my sample application and source code on Github.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 6.  RE: Raster SDK documentation and samples

    Posted 11-22-2020 21:06
    Thank you both.
    That's very usefull to get started.

    ------------------------------
    Alban Spella-Barberet
    NBN Co Limited
    North Sydney NSW
    ------------------------------