MapInfo Pro

Getting Started using Python In MapInfo Pro

  • 1.  Getting Started using Python In MapInfo Pro

    Employee
    Posted 29 days ago
    Here is some quick info on how to get started using Python in MapInfo Pro.

    Starting with v2019.1, Python is installed and ready to use out of the 'box'.

    See my post here for ideas on what you could do with python and why:
    https://community.pitneybowes.com/communities/community-home/digestviewer/viewthread?GroupId=19&MessageKey=72f33381-f319-497b-9b74-ee6a6c906a7d&CommunityKey=fe4d1ee2-f1c6-4307-87d2-00bea1344885&tab=digestviewer&ReturnUrl=%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3dfe4d1ee2-f1c6-4307-87d2-00bea1344885%26tab%3ddigestviewer

    First, you will want to get two Python help applications from the MapInfo Marketplace.
    The easiest way to do that is to type 'python' into the quicksearch toolbar. (It now also searches the Marketplace.)
    Type Ctrl+Q then type python:


    You will see two Python applications:

    Python Console

    You can use any Python IDE to develop your code, but we are providing a small Python Console via the MapInfo Marketplace to help with interactively editing and running small python scripts. It supports syntax highlighting and intellisense.

    Python Quick Start
    This add-in has many python code examples from simple to complex.
    In addition, in includes reference materials and links to web sites and documentation to help you get going.

    Click on the search results and the Marketplace window will open in Pro. Simply click the Install Product button.

    Then do the same for the Python Quick Start add-in.

    Here is a screen shot of the reference page:

    There are over 30 examples in various categories, and you can search for specific text like a mapbasic or python keyword you want to see how to use.

    Here is one example that tells Pro to convert a .csv file to a MapInfo Table:


    The edit button opens up the script into the Python Console.


    The Run button executes the script.

    Feel free to come here with questions or ideas.

    Please give it a try!

    -Bob




    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------