[GIS] How does GetFeatureInfo work on a WMS

getfeatureinfowms

What I know is that WMS is a tiled image of the layer, so my question is how does it get the attributes of the layer for queries and info-windows as long as it's an image? and why can't we edit them then?

Best Answer

What I know is that WMS is a tiled image of the layer

What you know isn't quite correct, a WMS provides images on request based on some data source. The data source can be either a raster data set, a vector data set, or indeed a combination of raster and vector data sets.

A WMS doesn't provide multiple tiles, a WMS provides a single image.

There is a similar service known as a Web Map Tile Service (WMTS), and this service splits the resultant image into tiles.

So for a WMS we make a request to make a map (a GetMap request) and this map is going to be based on one or more layers and each layer could be multiple data sets.

We specify all sorts of parameters to make our map, such as which layers we want, which projection we want, the bounding box in the projection we specify, the style we want the map to have, the height and width of the image in pixels, the output format for the image, and whether or not we want the image to have any transparency. There are other parameters but let's not worry about them here. So we send our request to the server and the server creates the map on-the-fly and sends it back to us to show in our GIS client.

How does GetFeatureInfo work on a WMS?

Now in our client we use an info tool to click on the map to get some information about a point on the map, and some information appears; we have carried out a GetFeatureInfo request. What the GIS client has done is work out the image coordinates of our click on the map for the image we requested in the previous GetMap request, and sent those image coordinates (X,Y or I,J) back to the WMS server, together with the majority of the parameters required to make the original map. The WMS can then query the layer(s) data source to get at the attribution, and instead of returning an image it returns the attribution for the query. Such a response doesn't necessarily return all the data in the attribute tables, nor all the geometry.

and why can't we edit them then?

You don't have sufficient knowledge of the underlying data to enable an edit, you just have a representation of the data, this is different from a WFS or WCS where your map request (GetFeature/GetCoverage) actually returns you all the data. Such services can be configured to allow updates of data (must have transactional capabilities) i.e. are WFS-T and WCS-T services.

Related Question