MapInfo Pro

 View Only

MapInfo Monday: Connect to a Internet Data Source with MapInfo Pro v2023

  • 1.  MapInfo Monday: Connect to a Internet Data Source with MapInfo Pro v2023

    Posted 10-02-2023 03:03

    Happy #MapInfoMonday

    In this week's post, I will present you with another improvement in MapInfo Pro v2023 that will help you access data from Internet sources. Well, it can be various types of sources and in various formats.

    This feature is based on the work with OGR Vector Data that we did for MapInfo Pro v2021.

    Many organizations share data via publicly accessible web services these days. Some of these organizations use services that already are spatial, such as OGC WMS, OGC WFS, and similar. You have for a long time been able to connect to these from MapInfo Pro.

    Others share their data through more basic web services. Well, now you can connect to these and benefit from that data with MapInfo Pro v2023.

     In my example, I will connect to a web service provided by the USGS, U.S. Geological Survey, of earthquakes around the World. This web service allows you to retrieve earthquakes and filter them by time and magnitude. The web service returns the result in GeoJSON that can be opened and mapped directly in MapInfo Pro. A resulting map from this data could look like this.

    Now let's see how we got to this point.

    Accessing Data using a URL in MapInfo Pro

    The first thing you need is to have a URL that points to the data you need or want to use. For the earthquakes, it's this URL:

    The format parameter controls the format of the data returned from the service. We will use geojson.

    There are at least 3 parameters you can use to limit the amount of records. The service will only allow you to access 10,000 records so make sure you don't break this limit or you will get nothing.

    • starttime: the from date in the data you are requesting, specified using an ISO date: yyyy-mm-dd
    • endtime: the to date in the data you are requesting, specified using an ISO date: yyyy-mm-dd
    • magnitude: allows you to filter out the smaller earthquakes. I have specified a minimum magnitude of 2

    With the URL ready, click on Open Table in MapInfo Pro, and in the Open dialog, click on the Open Connection button at the top right corner of the dialog.

    In the Open Connection dialog select OGR from the Connection Type list and hit OK.
    Now it is time to type in or paste the URL. If you have used the URL earlier you can find it in the OGR Web URL list. From the OGR DRiver list, select the format that your service returns. In this example, we will use GeoJSON - GeoJSON (OGR) as that's what we have specified for the service to return.
    Click OK to bring up any potential open options in the Vector File (OGR) Open Options dialog. This step depends on the format. In our example, we will leave the options as they are.
    When you hit the OK button, MapInfo Pro will connect to the service and retrieve the data. You will then be presented with some options on how to save this and how to style it in the Select One or More Table to Open dialog. If the service returns multiple datasets, you will also be asked to pick the ones you want to open.
    As this example only brings back one dataset, it has already been selected.
    Click the Options button to configure where and how to save the result.
    You can set the path to the tab file for your data, and you can change the Charset too. You can also check the Save Copy as MapInfo Table option for better performance. If you don't check this option, it will however refresh the data every time you open the table.
    Click the OK button here, and in the dialog you get back to, and MapInfo Pro will now load the data.
    This could be the initial view of the data. The style is my default symbol style that I could have changed when selecting the dataset earlier.
    You can now add some context by bringing in a base map like the Precisely Map you saw in the example at the top.
    And you can run a quick analysis to highlight the spot on Earth with the highest risk of earthquakes. In the example below, I have used the mag column.
    I hope this gives you some ideas of how to get to data exposed through web services using the OGR Web Connection. For MapInfo Pro to be able to map it, it must contain some spatial data that can be picked up from the service directly via the OGR Vector Drivers.
    Which web services would you like to connect to using the method?

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