[GIS] Get WMS info with Leaflet

geoservergetfeatureinfoleafletpostgiswms

I am trying to export (Excel, XML or PDF formats) WMS feature information using the following tools:

1.- GeoServer.-Provides a SQL statement which generates a WMS layer, based on polygon data.

2.- PostGIS.-Provides the functions to GeoServer SQL.

3.- Leaflet.-To show the results on a map viewer application.

I have seen how to do something like that with OpenLayers but I am developing with Leaflet and I don't know if it is possible.

To realize, the final objective is to export the information from a layer but the limit is another layer which is a polygon.

Best Answer

So to get at the feature information behind a WMS layer (an image) you must make a GetFeatureInfo request. A GetFeatureInfo request is a request for a pixel location (X,Y or I,J) in the map image provided to you from the WMS service; you can't get all the attribute information from an area delineated by a polygon.

The format of the data returned by the WMS GetFeatureInfo request is governed by the configuration of the service itself, so you can't request PDF for example, if the service itself doesn't support that format.

There are several questions on this site which relate to performing GetFeatureInfo requests with Leaflet