Getting information from the WMS server
Nowadays, the Web Map Service (WMS) has an important role in the GIS world, mainly because rendering tons of vector data at the client-side, no matter if its browser on a desktop consumes many resources.
If we think, in the OpenStreetMap project, where we have tons of vector data about streets, places, and so on, we can see that the main way to render data is in a raster way.
In this scenario, WMS servers allow us to get vector or raster data, from a shapefile, from a .geotiff
file, from a spatial database, and so on, and render all together as a single image. Not only that, if properly configured, a WMS server allows us to query information of a feature at a given point.
With OpenLayers, this can be easily done using the OpenLayers.Control.WMSGetFeatureInfo
control.
In the following screenshot, we can see what our current recipe looks like. Given some vector information about USA states, the server returns a raster image.
Once the control is activated...