Consuming WMS services with Leaflet

In the previous recipe, you have seen how to create a webGIS using the OpenLayers JavaScript API and then added the WMS PostGIS layers served from MapServer and GeoServer .

A lighter alternative to the widespread OpenLayers JavaScript API was created, named Leaflet. In this recipe, you will see how to use this JavaScript API to create a webGIS, add a WMS layer from PostGIS to this map, and implement an identify tool, sending a GetFeatureInfo request to the MapServer WMS. However, unlike OpenLayers, Leaflet does not come with a WMSGetFeatureInfo control, so we will see in this recipe how to create this functionality.

Get PostGIS Cookbook - 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.