MapInfo Pro

 View Only
  • 1.  Support Required for basic actions in MapInfo Python

    Posted 04-05-2022 08:20
    Hi Team,

    I am new in MapInfo python programming, where i have a  requirement to open one asc raster file, select the positioning and add some calculation and run the programme.
    But unfortunately, can't see any function to perform these task in available PQS. Can any one support on this?
    1- open .asc raster image
    2- choose the projection.
    3- Load Raster Image File for calculation
    4- Compute and get the output.

    Hope i am clear with the requirements.  Any help on this please?


    Thanks,
    Utkarsh

    ------------------------------
    Utkarsh Upadhyaya
    Knowledge Community Shared Account
    ------------------------------


  • 2.  RE: Support Required for basic actions in MapInfo Python

    Employee
    Posted 04-06-2022 05:27
    Hello Utkarsh,

    The above flow can be completed in two steps. 1st we will register the asc file and generate associated TAB file which will contain projection information. Then we will use calculator operation to compute new values from input asc file and generate output file based on particular expression.

    For registering the tab you will need to add something like below in your python code:
    do("Register Table \"{0}\" type RASTER CoordSys Earth Projection 1, 104 into \"{1}\"".format("D:\RasterData\ASCII\sample.asc","D:\\RasterData\\ASCII\\sample.tab"))​
    You will need to pass correct projection for asc file in the Register table command.

    Once done you can call calculator API to compute new values for input asc file. Example for running calculator operation through Python can be found in below thread. Refer reply#5:
    Calculator Example

    For information on how to use calculator tool and API you can refer MapInfo Pro Advanced documentation and API documentation under {MapInfo Installation Path}\Professional\Raster\Documentation\API\

    Hope this help. Let us know if you need any other help on the same.

    Thanks
    Anshul

    ------------------------------
    Anshul Goel
    Pitney Bowes Software Inc.
    Shelton CT
    ------------------------------



  • 3.  RE: Support Required for basic actions in MapInfo Python

    Posted 04-08-2022 06:56
    Thanks Anshul,
    For your response.
    But how to select the Register Table for coordinates. (i.e British Coordinate) i need to take.
    How to get that number in the registered table.

    ------------------------------
    Utkarsh Upadhyaya
    Knowledge Community Shared Account
    ------------------------------



  • 4.  RE: Support Required for basic actions in MapInfo Python

    Employee
    Posted 04-11-2022 03:53
    Hello Utkarsh,

    To find Coordsys clause string which you need to pass in Python script you can open the file in MapInfo and select correct projection for the file. In your case it will be British Coordinate. Once the file is opened successfully just open MapBasic window in MapInfo (Home->Tools Window->MapBasic).

    In Mapbasic window type the below command:
    print TableInfo({Your file name},29)​

    Something like below:

    You will need to pass the string that you get in Message window in Python script.

    Hope this helps.

    Thanks
    Anshul


    ------------------------------
    Anshul Goel
    Pitney Bowes Software Inc.
    Shelton CT
    ------------------------------