MapInfo Pro

MapInfo Monday: Exporting to GeoJSON

  • 1.  MapInfo Monday: Exporting to GeoJSON

    Employee
    Posted 02-15-2021 09:41
    Edited by Peter Møller 02-15-2021 09:47
    Happy #MapInfoMonday,

    The post of today is based on a question posted to the MapInfo Community last week: How can I convert my MapInfo tab file to GeoJSON?

    What is GeoJSON

    GeoJSON is an Open Standard format based on JSON. It has been extended to also support spatial features such as points, lines and polygons.

    It's not a new format but often used when sending data between systems or web applications.

    It's a text-based format and can therefore be open and modified in a basic text editor. But be careful not to break the structure of it.

    Read more about GeoJson on Wikipedia that I also used as a source for the information above.

    Exporting to GeoJSON from MapInfo Pro

    With the adoption of Python in MapInfo Pro, we have created a number of examples on how to use Python from within MapInfo Pro. One of these sample applications lets you export a MapInfo table to GeoJSON.

    First, you need to download and install the application Python Quick Start from the MapInfo Marketplace. On the Home tab, click on MapInfo Marketplace on the right of the tab.

    This will open up the MapInfo Marketplace. You will need an account to access it and you will also need to be signed in. It's the same account that you use for geocoding and creating drivetime regions via the Precisely API.

    The download and install the application click the Install Product button. In the image below, it says Reinstall Product because I have already installed the application.

    When you click the button, the application will be downloaded, installed, loaded into MapInfo Pro, and registered in the Tools window.

    The tool loads and displays the window Python Quick Start that you can see below. I have used the Search field to limit the samples to those mentioning "GeoJson" as you can see.

    To export a table to GeoJSON, click the Run button.
    There are only two stops to the application:
    1. Select the MapInfo table to export
    2. Select the name and location of the resulting GeoJSON file.

    To view the source code of the tool, click the Edit button.

    You can also run the export to GeoJSON tool directly. Use Run Program (earlier known as Run MapBasic application) and browse to the location of your MapBasic tools, typically: %localappdata%\MapInfo\MapInfo\Professional\1900\Tools. Here go into the folder PythonQuickStart\PythonScripts and select the file ExportToGeoJsonGDAL.py.

    You can also get to this folder using the Open Folder button shown above.

    For MapInfo Pro v2021 coming later in 2021, we are working on supporting more of the GDAL formats directly in MapInfo Pro. Any specific formats that you would like to have MapInfo Pro support?

    Thanks for asking the question last week, @Andreas Eppler.

    Stay tuned for another #MapInfoMonday post next week.

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