MapInfo Pro

 View Only

MapInfo Monday: Publishing Data via WFS in Spectrum Spatial

  • 1.  MapInfo Monday: Publishing Data via WFS in Spectrum Spatial

    Posted 12-20-2021 08:52

    Happy #MapInfoMonday,

    Today we will look at how you can use Spectrum Spatial to publish vector data files to users using the Web Feature Service provided by Spectrum Spatial.

    We have earlier looked at publishing data as tiles raster data using the WMTS Service of Spectrum Spatial.​ Publishing data via the WFS Service gives the client the actual spatial features and makes it possible to use these for further spatial analysis.

    If you wonder what Spectrum Spatial is, check out an earlier brief introduction to Spectrum Spatial.

    WFS, or Web Feature Service, is another standardized service developed by the OGC. This allows you to gain access to vector data served by a common standard. The WFS protocol describes how a server and a client need to communicate in order to gain access to geospatial features across the web. WFS allows you to access vector data but it also specified how you can create transactions and so pass changes back to the server.

    Named Table resource

    The WMTS Service discussed in the earlier article mentioned above used Named Maps. The WFS Service uses Named Tables. That is because we publish the actual spatial features and their attributes, not just an image of the map.

    In Spectrum Spatial Manager you can find the Named Table resources and see their details. Below you can see the details of the DK_Land_Cover table that we will publish via the WFS Service.

    You can use the tabs (Resource Info, Columns, Sample Rows, Permissions, and Preview) to inspect your named tables in more detail.

    Configuring the WFS Service

    You access the WFS Service via Services in the main menu in Spatial Manager. From the Services page, click on WFS to go to the page where you can configure the WFS Service and add named tables to publish through the WFS Service.

    Before adding our new named table to the WFS Service, let's inspect a few of the configuration options.

    From the Capabilities tab, you can view the actual WFS Capabilities document published through the WFS Service on Spectrum Spatial. You can see the different versions of the document by selecting the version in the dropdown list.

    On the Settings tab, you can see the URL used to access the WFS Service and you can set the Maximum Features value that helps limit the number of features returned. This limit can make sure a single request from a client doesn't take up too many resources.

    If you go to the Service Info tab, you can set contact information that will get published through the capabilities document.

    Adding New Features to Publish

    Go back to the Features Types tab to add more named tables to your WFS Service on Spectrum Spatial.

    Use the Add Feature Type button on the top left side to open up the Add Feature Type area. This is where you select named tables to publish through the WFS Service.

    First, you need to select the named table that you want to publish. Click on the button to the right of the Reference Table field to browse and select a named table.

    In the dialog Select a table, you can browse through the hierarchy of the repository and select the table to publish.

    If you have many tables in your Spectrum Spatial repository, you can switch to the List view in the Select a Table window and here you are able to search for the specific table.

    In the example below, I have filtered the list with the word "land_cover" and in this way limited the list of tables to only 10 from the total list of almost 1600.

    Select the table you want to publish and click on the Select button.

    Back in the Add Feature Type area, you need to enter a name for the published table. Typically, you will use the same name as the selected named table, unless you have specific reasons not to use that name. You could decide to change this to give the table a better name.

    You will also have to specify a Repository Folder for the new resource you are creating. As you can see, I am using a new folder structure under WFS but this is up to you. By saving these WFS Feature Type resources to a dedicated WFS repository it's harder to confuse these resources with a normal named table and it will be easier to maintain (say delete) these named resources later.

    Finally, you need to Select Namespace for the named resource. The combination of namespace and named WFS Feature Type resource must be unique. You can add multiple namespaces to the WFS Service.

    When you have specified these configurations, you can click on Save to create the new Named WFS Feature Type.

    If you need to add multiple tables to the WFS Service, you can keep adding a new one as soon as you have saved the previous one.

    Accessing the WFS Service from MapInfo Pro

    Now it's time to make sure the WFS Service works. Let's access the service from within MapInfo Pro.

    If you haven't already configured your WFS Service in MapInfo Pro, go to the Settings tab and copy the Online Resouce / Service URL. In MapInfo Pro open the Open WFS Table dialog from the Open dropdown, click on Servers... in the top right corner and click on Add Server. Now paste the URL you copied and verify that it works and give the service a recognizable name.

    Back in the Open WFS Table dialog, you can now select one of the WFS Layers to open. 

    We recommend that you use the Row Filter option to limit the WFS Table to fetch records from the current map extent. This is especially important if the service holds thousands of records and you want to limit the response time. In the Row Picker dialog, you select the spatial object from the Column dropdown, BBOX from the Operator list, and in the Value list you select CURRENT_MAPPER.

    Note that MapInfo Pro v2021 added support for Paging. Spectrum Spatial also has support for this which means you will be able to take advantage of this when you connect MapInfo Pro to your WFS Services from Spectrum Spatial. This basically allows you to fetch more records from the server than the Maximum Features says it can return. This is possible because the response from the server is split into smaller pieces.

    Below you can see that I have loaded a bit more than 3000 records into MapInfo Pro from the WFS Service even though it was configured to only allow 1000 records as a maximum. Also, notice the browser window on the right showing the attribute information from the table.

    Spectrum Spatial allows you to publish vector data for consumption in MapInfo Pro and in other clients too. And from within MapInfo Pro, you can access this service published from Spectrum Spatial and from other WFS supporting servers too.

    I hope that you have found this article useful. Are you already using WFS Services in MapInfo Pro and/or publishing data through WFS Services?

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