MapInfo Pro

 View Only
  • 1.  MapInfo Pro Extensibility for Python

    Employee
    Posted 06-03-2019 07:20
    Edited by Shweta Shukla 06-18-2019 00:07

    Being driven by the continuous inputs from our industry partners and customers, MapInfo Pro 17.0.3 extends the existing Add-In model to include support for Add-Ins written in the Python language.

    Python is much more than just a scripting language and enabling the developer community to incorporate use of their own Python environment modules directly into the MapInfo Pro application environment talks about the health of the product and the growth prospects for the MapInfo Pro user.

    With the changes in the MapInfo Extensibility model, the Python Add-In developers will have access to the development interface for bringing in their own apps into the product, add ribbon interface, create commands, and this is just the beginning! While users can make use of any of the libraries and functionality available to Python, the ability to perform data analysis on MapInfo Pro table attribute data using the rich set of available Python data analysis tools (e.g., pandasSciPymatplotlib) will be very useful to many in the community. Python developers will be able to build the Add-Ins using their own Python 3.7 development environment. The ease of Python language, its high portability and use across platforms and high scalability makes it an excellent choice to extend support.


    Setting Up MapInfo Pro Python Add-in

    This can be done in a few simple steps.

    Python Setup: 

    1. Get the latest 64-bit installer of Python version 3.7 version from: https://www.python.org/downloads/

                           Note:   Make sure to use the Windows x86-64 executable installer under Downloads.

    1. Run the installer as an Admin and choose Custom Install
    2. Make sure to install for ALL Users (Install Directory will default to: C:\Program Files\Python37)
    3. Check box for setting PATH variable and pre-compiled binaries

    Machine Environment Setup:

    Set the SYSTEM environment variable "PYTHONHOME"  to the Python installation directory (C:\Program Files\Python37)

    NOTE: 

    • To access MapInfo Table Data in your python add-in, install GDAL python bindings.
    • Visual Studio Code is our preferred choice for writing and debugging the python add-ins.
                 For more details refer to VSCODE python debugging : https://code.visualstudio.com/docs/python/debugging


    With the Python setup done, you can start creating your own add-ins.
     

    The MapBasic 17.0.3 installation contains two python add-in templates for creating a simple MapInfo Pro add-in or a layout custom frame add-in in python.

    • SAMPLES\RIBBONINTERFACE\Python\py_addin_templates\Simple
    • SAMPLES\RIBBONINTERFACE\Python\py_addin_templates\CustomFrame

     Use one of the existing python add-in templates to start.



    The above snapshot shows a MapInfo Table file of a region in Australia. Using the GDAL/OGR module in python we have created a scatter plot showing the weekly rent against the total household income of a demographic data.

    This has been included as one of the samples - SAMPLES\RIBBONINTERFACE\Python\py_addin_gdal

    Using the available Python modules like pandasSciPymatplotlib and GDAL/OGR module for accessing MapInfo table data for analysis, data conversion and management, can help increase productivity.

    With different datasets opened in MapInfo Pro, any attribute can be accessed, graphs plotted and charts created with the power of Python!


    Tagging @Anshul Goel



    ------------------------------
    Shweta Shukla
    Pitney Bowes Software India
    Noida
    ------------------------------


  • 2.  RE: MapInfo Pro Extensibility for Python

    Employee
    Posted 06-18-2019 01:05
    Hi Shweta...

    On behalf of one of our valued Australian based MNO MapInfo customers... they've asked if there is a way to install the GDAL python bindings with a computer that has no network connection?

    Can you provide some direction on this please? 

    Kind regards, 
    Kolt

     


    ------------------------------
    Kolt Luty
    Pitney Bowes Australia Pty Ltd
    ------------------------------



  • 3.  RE: MapInfo Pro Extensibility for Python

    Employee
    Posted 06-19-2019 03:09
    Edited by Anshul Goel 06-19-2019 03:30

    Hi Kolt,

    To install Python Bindings for GDAL without network you would have to provide the customer with the copy of "GDAL‑3.0.0‑cp37‑cp37m‑win_amd64.whl" from https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal website.

    Once they have the wheel file on there machine, they would have to open Administrator command prompt and execute "pip install <path to GDAL‑3.0.0‑cp37‑cp37m‑win_amd64.whl>".

    This will install GDAL python Bindings, which will allow them to open Native Tab files using MITAB driver only.

    Before doing this, make sure they have Python 3.7 x64 installed and all setup done as mentioned in MapInfo Pro v17.0.3 release notes.

    Note : wheel file customer will be installing is created by Opensoure 3rdParty and is not part of MapInfo Pro.

    Thanks

    Anshul



    ------------------------------
    Anshul Goel
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 4.  RE: MapInfo Pro Extensibility for Python

    Posted 01-07-2020 13:53

    GDAL‑3.0.0‑cp37‑cp37m‑win_amd64.whl is no longer available on www.lfd.uci.edu (latest is 3.0.2). If you still need 3.0.0, you will have to install/build from source following the instructions at https://support.pitneybowes.com/SearchArticles/VFP05_KnowledgeWithSidebarHowTo?id=kA11E000000TNmcSAG&popup=false;&lang=en_US

    However, the pip command on that page is incorrect. If you installed GDAL using OSGeo4W to "C:\OSGeo4W64" then the pip command to install the python package is:
    python -m pip install --global-option=build_ext --global-option="-IC:\\OSGeo4W64\\include" --global-option="-LC:\\OSGeo4W64\lib" GDAL



    ------------------------------
    John Hall
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 5.  RE: MapInfo Pro Extensibility for Python

    Posted 01-07-2020 13:54

    If you happened to install the binaries for GDAL 3.0.0, then the above command is:

    python -m pip install --global-option=build_ext --global-option="-IC:\\OSGeo4W64\\include" --global-option="-LC:\\OSGeo4W64\lib" GDAL==3.0.0



    ------------------------------
    John Hall
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 6.  RE: MapInfo Pro Extensibility for Python

    Posted 01-07-2020 14:48

    Important: You will need the MapBasic 17.0.3 installation to access the samples mentioned above.

    https://www.pbinsight.com/support/product-downloads/item/mapbasic-v17.0.3-download



    ------------------------------
    John Hall
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------