0

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?

  • GetFeatureInfo is not meant for editing. It may occasionally work but you can't trust in it. Fetch you vectors through WFS. – user30184 May 5 '15 at 9:40
  • @user30184: Thanks, I have edited the question at the bottom. Can u check please? – Mohayemin May 7 '15 at 12:27
  • Your use case makes sense and is perfectly valid but OGC standards (WMS and WFS) have not taken that into account. GetFeatureInfo is not planned for returning geometries in their original accuracy but mainly to answer to question "What is here on a map". You mention also the styles, they can and do alter data by filtering, simplifying, and altering and what you see on the map is rendered from that processed data. You can use WFS after you have converted pixel coordinates into projected coordinates. There may be a way to improve the quality of GetFeatureInfo geometries, I just do not know such. – user30184 May 7 '15 at 12:53
  • What could work is to use GetFeatureInfo for finding FID of the feature and make another request with WFS by that FID. – user30184 May 8 '15 at 4:47
  • @user30184: Geting FID then requesting WFS was in our plan but that was really left as a last option. However, Researching a lot about this matter suggests that thats the most useful solution. Perhaps that is what I will do. Off topic - Why dont you use your real name! – Mohayemin May 8 '15 at 15:14
1

Is there a way to tell WMS GetFeatureInfo to retrieve all vertices?

No

As @user30184 mentions in their comment:

GetFeatureInfo is not planned for returning geometries in their original accuracy but mainly to answer to question "What is here on a map".

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.

I could use WFS... However, in that case how can I consider style of the layer.

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:

... I will have to translate the pixel to coordinates, which can be done.

As @user30184 also mentions and which you considered, you could obtain the the Feature identifier (FID) from the WMS GetFeatureInfo request then do a WFS GetFeature request specifying the featureID parameter, or if your service supports it, by using a GetFeatureById stored procedure.

You can check which stored query you have with a request like:

http://localhost:8080/geoserver/MyWorkSpace/wms?SERVICE=WFS&request=ListStoredQueries&version=2.0.0&

Which would give a response like:

<wfs:ListStoredQueriesResponse 
 xsi:schemaLocation="http://www.opengis.net/wfs/2.0 .../schemas/wfs/2.0/wfs.xsd">
  <wfs:StoredQuery 
    id="urn:ogc:def:query:OGC-WFS::GetFeatureById">
    <wfs:Title xml:lang="en">Get feature by identifier</wfs:Title>
    <wfs:ReturnFeatureType/>
  </wfs:StoredQuery>
</wfs:ListStoredQueriesResponse>

Another option would be to create your own Stored Query

1

WMS and WFS are not mutually exclusive!

For example, this map of Glenorchy's stormwater, uses WMS to display data, and WFS to show information about the data.

With OpenLayers, you can get LatLon from a pixel value, so it's very easy to fire off a WFS request to get the actual data.

In this way, you can style using GeoServer and edit using WFS all at the same time!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.