O'Reilly logo

PostGIS Cookbook by Bborie Park, Stephen Vincent Mather, Thomas J. Kraft, Paolo Corti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Consuming WMS services with Leaflet

In the previous recipe, you have seen how to create a web page with a map using the OpenLayers JavaScript API and then added to the map the WMS PostGIS layers implemented with MapServer and GeoServer in the first two recipes of this chapter.

A new, lighter alternative to the widespread, venerable OpenLayers JavaScript API has emerged in the last couple of years, named Leaflet. In this recipe, you will see how to use this JavaScript API to create a map in a web page, add a MapServer WMS layer from PostGIS to this map, and implement an identify tool sending a GetFeatureInfo request to the MapServer WMS (unlike OpenLayer, Leaflet does not come with a WMSGetFeatureInfo control).

How to do it...

Carry out the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required