Mixing WMS and WFS

As we have seen in the previous examples, using OpenLayers, you can create maps by mixing data from different servers. Although WMS is an excellent way to get a representation of data, sometimes, you may want to retrieve data in a raw form and process them on the client side. OpenLayers lets you create WFS requests to retrieve vector data. In this example, we will mix WMS and WFS requests.

  1. Open your text editor and insert the following piece of code in a new file. We will use the same properties of the previous examples. Call it WMSandWFS.html and save it in the Tomcat folder to publish it:
        <!DOCTYPE html> 
        <html> 
        <head> 
        <title>WFS - GetFeature</title> 
        <link rel="stylesheet" href="https://openlayers.org/ en/v4.2.0/css/ol.css" ...

Get GeoServer Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.