I have some geoserver layers created from PostGIS tables. I load them on map using OpenLayers and use WMS GetFeatureInfo to get features on mouse click.
I have observed that GetFeatureInfo request optimizes the returned Geometries by merging vertices which are very close. However, for editing, I need to get all the vertices.
Is there a way to tell WMS GetFeatureInfo to retrieve all vertices?
Here is a sample request I am sending:
http://localhost:8080/geoserver/MyWorkSpace/wms
?LAYERS=MyLayer
&QUERY_LAYERS=MyLayer
&STYLES=MyLayer_Style
&SERVICE=WMS
&VERSION=1.1.1
&REQUEST=GetFeatureInfo
&BBOX=10064619.024143,2730298.878509,10064682.024975,2730340.381427
&FEATURE_COUNT=10
&HEIGHT=556&WIDTH=844
&INFO_FORMAT=application/vnd.ogc.gml
&SRS=EPSG:900913
&X=302
&Y=265
As commented by user30184, I could use WFS. But it appears that WFS does not take pixel coordinates as input. So I will have to translate the pixel to coordinates, which can be done.
However, in that case how can I consider style of the layer. For example, for a point layer with large radius, user might not be able to select the points even if clicking inside the point. Am I missing something?
Best Answer
No
As @user30184 mentions in their comment:
A WMS is by design a way of presenting a representation of a set of data as a map (often you get different representations of the same data as you zoom in or out). A
GetFeatureInfo
request acts on the map representations, that what the X,Y (or I,J) coordinates are in the request.A WFS gives you all the raw (vector) data, and once you have this you can style it any way you like.
A WFS does take an optional bounding box parameter so as you say:
As @user30184 also mentions and which you considered, you could obtain the the Feature identifier (FID) from the WMS
GetFeatureInfo
request then do a WFSGetFeature
request specifying thefeatureID
parameter, or if your service supports it, by using aGetFeatureById
stored procedure.You can check which stored query you have with a request like:
Which would give a response like:
Another option would be to create your own Stored Query