MapInfo Pro

 View Only

MapInfo Monday New OGR Table Format in MapInfo Pro v2021

  • 1.  MapInfo Monday New OGR Table Format in MapInfo Pro v2021

    Employee
    Posted 10-07-2021 02:29

    Happy #MapInfoMonday on this fine Thursday.

    As you may know by now, during the release week of MapInfo​ Pro 2021 it's #MapInfoMonday all week long which means a new post each day. These posts will of course discuss some of the new features that we added to the latest release of our favorite spatial analytics desktop tool.

    Every spatial analysis starts by accessing the data you want to analyze. ​The more data formats, you can access, the easier you can get to the fun part of doing the analysis. With MapInfo Pro v2021, we added a completely new table type, the OGR table type.

    OGR, also known as the Simple Features Library, is a list of vector file drivers supported through GDAL. You can read more about the different file formats that OGR support via the GDAL Vector Drivers. Keep in mind that MapInfo Pro supports many of these drivers but not all. Some of the drivers only support reading the format, other drivers also support write access to the files.

    MapInfo Pro will generally support the formats that GDAL lists as "Built-in by default". Besides these, we also added drivers for a couple of other formats that we wanted to support, such as GML, KML, SQLite, and Excel files.

    MapInfo Pro is currently using GDAL version 3.0.4.

    Here's list of the most notable formats that MapInfo Pro supports: *.dxf; *.csv; *.txt; *.shp; *.geojson; *.json; *.gml; *.kml; *.kmz; *.sqlite; *.gpkg; *.xls; *.xlsx; *.ods. Some formats have been supported through Universal Translator, via the older Export/Import capability, or via the Open Table dialog. Accessing these formats through the new OGR table format adds a new way to access data, and it also adds some additional capabilities to the opening process such as automatically creating objects from values in the file or giving you write access to the files.

    Let's look at how it works.

    Open data files through the OGR Vector File drivers

    You can access these formats directly through the Open dialog that you also use to open workspaces and native tab files. In the Files of Types list, you can now find Vector Files (OGR) close to the end of the list.

    This lists a number of the formats supported through OGR. These are the formats we think are most common and that we also have tested.


    OGR does however support more formats. You can select All Vector (OGR) Formats just below, and MapInfo Pro will expand the list of formats to include all the formats that may work within MapInfo Pro. We have not tested all these formats so you can run into a file in a specific format that will fail to load.

    We will try opening a GPX file from the expanded list of formats. Select the GPX format in the list, and MapInfo Pro will limit the list of files to be of type GPX.


    Now you can select the file or files, you want to open. If you use the compiled list of common formats, you will be able to select files of different formats. Click Open to continue the process.

    Options for opening OGR files

    The Vector File (OGR) Open Options dialog you will see depends on the file type, that is the OGR driver, you have selected. Each OGR driver has a number of options or parameters that help OGR open and access these file formats.

    When opening a GPX file, there are no specific OGR parameters to set and so this dialog is not shown. You can find detailed information about the parameters on the GDAL website.

    If you open a CSV file through the Vector Files (OGR) file type, you will be presented with a dialog like the one below. We have configured it with a typical set of parameters. You can however tweak these if you want to. Again use the GDAL website to understand the different parameters. You can access the GDAL website for the specific format using the Help button.

    In this specific case, I know that the columns holding my coordinates have text in front of the strings "lat" and "lon" so I'm adding an asteryx (*) in front of these strings in the fields XPOSSIBLE_NAMES and YPOSSIBLE_NAME to make the OGR driver pick up these columns. If the OGR driver is able to locate columns with coordinates, points will automatically get created during the open process.

    Also, note that CSV files also support more complex spatial objects through the support of Well Known Text. You can specify the field holding these geometry strings in the field GEOMPOSSIBLE_NAMES.


    I have just shown one example of Vector File (OGR) Open Options. These vary across the different formats but are well-documented through the GDAL website.

    Open Options

    Once you have configured the potential parameters for the OGR driver, you will be prompted to select the tables or datasets you want to open from the selected file(s).

    In the Select One or More Tables to Open dialog, you will have to select one or more datasets presented in the list.


    You can use the options above to control how to open these tables into MapInfo Pro. You can set the style details, specify the coordinate system, and using the Options button you can configure a few other details around accessing the files.

    The Vector File (OGR) Open Options dialog will depend on the format that you are opening. Below you can see the dialog as it looks when opening a GPX format. For other formats, you may see some OGR Parameters too. These will be similar to the parameters you saw in the Vector File (OGR) Open Options dialog that is shown after the Open dialog.

    In the dialog above, I have specified that I want to save the data from the GPX file into a native MapInfo table by checking Save Copy as MapInfo Table. This will run a background thread in the Task window to save the data from the GPX file into one or more native MapInfo tables. While this is running you can continue to use MapInfo Pro.

    If you don't save the data into a native MapInfo table, MapInfo Pro will access the data directly from the file you selected. For some formats, the data access will be slower.

    Seeing the data in MapInfo Pro

    Below you can see the GPX data loaded into a number of MapInfo tables. All the tables are shown in the map window but for some of the tables, this specific GPX file had no data.

    Notice that the Table List shows these tables as Native because I chose to save them into native MapInfo tables during the open process.

    In the Task window, you can see the tasks that have been run to save the different datasets into native MapInfo tables.


    If I had chosen not to save the GPX data into native MapInfo tables, they would have been opened as the new OGR Table type in MapInfo Pro. You can see this in the Table List below.

    Export

    I have only touched upon accessing these file formats via the Open dialog. But you can in fact use these formats for export too.
    We have renewed our old Export capability to support the Vector Files formats. And the new Export Table(s) to File(s) dialog now allows you to export multiple files at a time. You can use the Name Pattern field to control the naming of the exported files. From the Export as Type list, you can select from a wide list of formats including the new Vector Files (OGR) formats.


    And similar to opening the new Vector Files (OGR) files, you will also be presented with a dialog presenting you the OGR driver parameters when exporting via these formats. Also note that by default, exporting through these OGR drivers will happen in a background thread.

    Final words

    Besides accessing local files stored on your hard drive or on your network, there are also options for accessing files from the internet. This does however require a bit of coding as this support hasn't been built into the user interface. This could require using the metadata tag NoFileTable. We will cover this in a coming #MapInfoMonday post.

    I will generally recommend looking through the documentation for Vector Files (OGR). Specifically, the help topic OGR Table Properties gives some good clues on what to be aware of.

    What format will you be accessing through this new range of formats? Is there a format that you would like us to add to the list of commonly used formats?

    Stay tuned for more news of MapInfo Pro v2021 tomorrow.



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