3.10. Importing Vector Data with WFS

Servers that support the Web Feature Service (WFS) specification from the Open Geospatial Consortium (OGC) provide access to vector feature data over the internet. Although the protocol has been around for some time (it's been implemented in Cartographica and CartoMobile for a number of years now), it is not as popular as other online map format services, such as Web Map Service (WMS), Web Map Tile Service (WMTS). However, it has a unique feature that it actually provides geometric data instead of just visual representations.  As such, the geometric fidelity and associated information can be substantial.  In addition, there is a writable version of the service (WFS‑T, Web Feature Service-Transactional) which can be used to write data back to the server.  Although Cartographica does not support WFS‑T as of this writing, CartoMobile does support it as a mechanism for implementing remote data collection.

Cartographica considers WFS to be a data source, but locally caches information retrieved from the server so that it can be used offline.

Acquire data from a WFS Server

Acquire feature data over the internet from a OGC-compliant WFS Server

  1. Choose File  >  Add Web Feature Layer….

    The Add Web Feature Layer sheet appears

    Add Web Feature Layer Sheet

    Figure 3.10. Add Web Feature Layer Sheet


  2. Type or paste the URL for the WFS server into Server URL

  3. Type or paste the name of the chosen layer into Layer

  4. Click Add

    Cartographica will add a layer to the Layer Stack with the name of the layer and will retrieve the information from the WFS server. If the server is unavailable or requires a password, you will be prompted for any supplemental information.

Editing Existing WFS Layers

It is possible to change the parameters for an existing WFS layer. To do so:

  1. Choose Layer  >  Web Feature Layer Attributes….

    The Add Web Feature Layer sheet appears with the current data pre-filled

  2. Change parameters as desired

  3. Click Save

    the filter is re-run and any new items are added to the local copy of the layer. It's important to remember that existing features are not deleted, so you will have to manually remove them if you want them taken out of the layer

3.10.1. Filtering data from a WFS Server

There are times when a WFS layer contains a combination of relevant and irrelevant data. In those cases, the Filter box in Add Web Feature Layer can be used to limit what is downloaded from the server. The form of the filter is an expression that is evaluated by the WFS server and can be pretty esoteric. It is suggested that if you want to filter the information, you coordinate with your WFS server administrator or consult the documentation for the provided layers in order to determine the format and function of the filters. Some examples follow.

Example 3.1. Filter by property

<ogc:PropertyIsGreaterThan>
    <ogc:PropertyName>DATE_</ogc:PropertyName>
    <ogc:Literal>'2012-09-15'</ogc:Literal>
</ogc:PropertyIsGreaterThan>

      

This filter looks for features that have property that is named DATE_ which is greater than 2012-09-15. The formatting needs to be precise and Cartographica will validate it with the server, so that you can make changes and re-submit if necessary.


Example 3.2. Filter by property


<ogc:And>
    <ogc:PropertyIsGreaterThan>
        <ogc:PropertyName>DATE_</ogc:PropertyName>
        <ogc:Literal>'2012-09-15'</ogc:Literal>
    </ogc:PropertyIsGreaterThan>
    <ogc:PropertyIsEqualTo>
        <ogc:PropertyName>SOURCE</ogc:PropertyName>
        <ogc:Literal>BIC</ogc:Literal>
    </ogc:PropertyIsEqualTo>
</ogc:And>

      

This more complex filter builds upon the previous filter and also requires that the SOURCE property be equal to BIC. Note the use of the outer And command to dictate that feature match both conditions. You could also use an Or here to dictate that matching either condition be matched. The specific operators available may vary by server, but they generally take the same form and are always represented by XML.