Bug report #5896

Identify of WMS layers does not work

Added by Giovanni Manghi over 11 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Radim Blazek
Category:Web Services clients/WMS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15345

Description

New description:

see comments 27 and 28

----------------------------
Old description:

when reprojecting (in a different CRS) WMS layers that at the source are point/line vectors, then the identify tool does not returns no results.

This ticket has been a little "wild", so the new description is to make things a little clear.

There was an issue also with polygons, but this seems to work (as server tested both qgis server and mapserver). I'm not sure about lines.

The identify of reprojected rasters also seems to work ok now, but I tested only with qgis server.

----------------------------
Old Old description:

This affects both 1.8 and master.

Use the attached projects to test. The WMS layer in the project is originally in wgs84. When reprojected in a projected CRS/project the identify tool gives different values when querying the same pixels.

wms_identify_18.qgs (8.23 KB) Giovanni Manghi, 2013-09-30 12:32 AM

wms_identify_201.qgs (6.38 KB) Giovanni Manghi, 2013-09-30 12:32 AM

wms_identify_master.qgs (8.23 KB) Giovanni Manghi, 2013-09-30 12:32 AM

wms_identify_18_notreprojected.qgs (6.34 KB) Giovanni Manghi, 2013-09-30 01:04 AM

wms_identify_18_reprojected.qgs (6.12 KB) Giovanni Manghi, 2013-09-30 01:04 AM

wms_identify_201_notreprojected.qgs (4.26 KB) Giovanni Manghi, 2013-09-30 01:04 AM

wms_identify_201_reprojected.qgs (6.04 KB) Giovanni Manghi, 2013-09-30 01:04 AM

Associated revisions

Revision 62075294
Added by Radim Blazek about 10 years ago

identify reprojected raster: use 1x1 pixel context in layer crs to get reasonable search tolerance for WMS GetFeatureInfo, fixes #5896

History

#1 Updated by Jürgen Fischer over 11 years ago

  • Assignee deleted (Marco Hugentobler)

#2 Updated by Jürgen Fischer over 11 years ago

The WMS references in the projects times out...

But thanks for that - that way I notices that the network time outs didn't work :)

#3 Updated by Giovanni Manghi over 11 years ago

Jürgen Fischer wrote:

The WMS references in the projects times out...

Yes, that server is down until next week, anyway you can test with any server

But thanks for that - that way I notices that the network time outs didn't work :)

#4 Updated by Giovanni Manghi over 11 years ago

Jürgen Fischer wrote:

The WMS references in the projects times out...

it works again

#5 Updated by Giovanni Manghi over 11 years ago

  • File deleted (wms_reprojected.qgs)

#6 Updated by Giovanni Manghi over 11 years ago

  • File deleted (wms_not_reprojected.qgs)

#7 Updated by Giovanni Manghi over 11 years ago

  • File wms_reprojected.qgs added
  • File wms_not_reprojected.qgs added

Still confirmed on master. Two sample projects attached.

#8 Updated by Giovanni Manghi about 11 years ago

  • Priority changed from High to Normal

#9 Updated by Giovanni Manghi over 10 years ago

  • Priority changed from Normal to Severe/Regression
  • File wms_identify_18.qgs added
  • File wms_identify_201.qgs added
  • File wms_identify_master.qgs added
  • Subject changed from Identify of reprojected WMS gives wrong values to Identify of reprojected WMS gives wrong values (now identify of wms layers does not work at all on 2.0.1/master)
  • Target version changed from Version 2.0.0 to Future Release - High Priority

The identify of WMS layers does not seems to work at all in 2.0.1 and master, even with otfr off.

Attached examples, you must open with qgis 1.8 and 2.0.1 or master: in 1.8 the identify works, with the same layers from the same server in 2.0.1/master identify does not work, so at this moment I can't even test if the original issue described here is still an issue or not (likely to be).

#10 Updated by Giovanni Manghi over 10 years ago

Giovanni Manghi wrote:

The identify of WMS layers does not seems to work at all in 2.0.1 and master, even with otfr off.

Well, this is not true with all the servers. I have just tested one where identify works, but I can (obviously) confirm that in 1.8 when OTFR in on the results are wrong.

Open attached projects (wms_identify_18_reprojected / wms_identify_18_notreprojected) in qgis 1.8 and test by identifying the red polygon will show in the canvas.

On the other hand identifying the same layer in QGIS 2.0.1/master with OTFR on leads qgis to crash:

*open the attached projects in qgis 2.0.1 (wms_identify_201_reprojected / wms_identify_201_notreprojected)
*identify something
*click on the result window -> instant crash if the project is the onw with OTFR on

#11 Updated by Giovanni Manghi over 10 years ago

  • File deleted (wms_not_reprojected.qgs)

#12 Updated by Giovanni Manghi over 10 years ago

  • File deleted (wms_reprojected.qgs)

#13 Updated by Giovanni Manghi over 10 years ago

  • Subject changed from Identify of reprojected WMS gives wrong values (now identify of wms layers does not work at all on 2.0.1/master) to Identify of reprojected WMS gives wrong values, does not work or leads to qgis crash

Giovanni Manghi wrote:

Giovanni Manghi wrote:

The identify of WMS layers does not seems to work at all in 2.0.1 and master, even with otfr off.

Well, this is not true with all the servers. I have just tested one where identify works, but I can (obviously) confirm that in 1.8 when OTFR in on the results are wrong.

Open attached projects (wms_identify_18_reprojected / wms_identify_18_notreprojected) in qgis 1.8 and test by identifying the red polygon will show in the canvas.

On the other hand identifying the same layer in QGIS 2.0.1/master with OTFR on leads qgis to crash:

open the attached projects in qgis 2.0.1 (wms_identify_201_reprojected / wms_identify_201_notreprojected)
identify something
click on the result window -> instant crash if the project is the onw with OTFR on

#14 Updated by Radim Blazek over 10 years ago

The bug in master (will be 2.1), i.e. crash if format is feature and OTFR is no was fixed by commit 96bd7e7, see #8724.

This issue should be probably divided in two, because the issues with 1.8 and 2.0/master are different.

#15 Updated by Giovanni Manghi over 10 years ago

Radim Blazek wrote:

The bug in master (will be 2.1), i.e. crash if format is feature and OTFR is no was fixed by commit 96bd7e7, see #8724.

This issue should be probably divided in two, because the issues with 1.8 and 2.0/master are different.

this ticket is really about the wrong identify result issue. At some point I was just saying that because of the crash I wasn't able to prove the issue on qgis 2.0.

#16 Updated by Giovanni Manghi over 10 years ago

  • Priority changed from Severe/Regression to Normal
  • Subject changed from Identify of reprojected WMS gives wrong values, does not work or leads to qgis crash to Identify of reprojected WMS gives wrong values or does not work
  • Crashes QGIS or corrupts data changed from Yes to No

#17 Updated by Radim Blazek over 10 years ago

Giovanni Manghi wrote:

this ticket is really about the wrong identify result issue. At some point I was just saying that because of the crash I wasn't able to prove the issue on qgis 2.0.

OK, in that case the target version should be lowered to 1.8, but there is no such version in the options.

#18 Updated by Giovanni Manghi over 10 years ago

  • Subject changed from Identify of reprojected WMS gives wrong values or does not work to Identify of WMS layers does not work or gives wrong values when layers are reprojected
  • Priority changed from Normal to Severe/Regression

I confirm that identify WMS layer seems broken in 2.0.1/master

Add this layer (postos de vigia)
crs=EPSG:3763&featureCount=10&format=image/png&layers=Postos%20de%20Vigia&styles=&url=http://mapas.dgterritorio.pt/wms/crif

from this server
http://mapas.dgterritorio.pt/wms/crif

in a new project, in one of the proposed CRSs and no reprojection.

  • on qgis 1.8 indentify works
  • on qgis 2.0.1/master the identify does not find anything

#19 Updated by Giovanni Manghi over 10 years ago

Giovanni Manghi wrote:

I confirm that identify WMS layer seems broken in 2.0.1/master

Add this layer (postos de vigia)
crs=EPSG:3763&featureCount=10&format=image/png&layers=Postos%20de%20Vigia&styles=&url=http://mapas.dgterritorio.pt/wms/crif

from this server
http://mapas.dgterritorio.pt/wms/crif

in a new project, in one of the proposed CRSs and no reprojection.

  • on qgis 1.8 indentify works
  • on qgis 2.0.1/master the identify does not find anything

tested also with
http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/raster/DTM_75M.map

#20 Updated by Giovanni Manghi over 10 years ago

see also #8724-17

(identify of reprojected wms layer is wrong).

#21 Updated by Giovanni Manghi about 10 years ago

  • Subject changed from Identify of WMS layers does not work or gives wrong values when layers are reprojected to Identify of WMS layers does not work for reprojected point layers

#22 Updated by Giovanni Manghi about 10 years ago

Radim Blazek wrote:

The bug in master (will be 2.1), i.e. crash if format is feature and OTFR is no was fixed by commit 96bd7e7, see #8724.

This issue should be probably divided in two, because the issues with 1.8 and 2.0/master are different.

Hi Radim,

I added a new description/title to this ticket to makes things a little more clear. It seems that overall things are ok. The only remaining issue seems to be with reprojected point layers: the identify does not return any result. reprojected Polygons are ok (rasters too), not sure about lines.

#23 Updated by Giovanni Manghi about 10 years ago

  • Subject changed from Identify of WMS layers does not work for reprojected point layers to Identify of WMS layers does not work for reprojected point and line layers

I added a new description/title to this ticket to makes things a little more clear. It seems that overall things are ok. The only remaining issue seems to be with reprojected point layers: the identify does not return any result. reprojected Polygons are ok (rasters too), not sure about lines.

it affects lines too

#24 Updated by Radim Blazek about 10 years ago

  • Assignee set to Radim Blazek

#25 Updated by Radim Blazek about 10 years ago

  • Status changed from Open to Closed

#26 Updated by Radim Blazek about 10 years ago

Confirmed for points and lines and fixed. Identify tool is now using as context 1x1 pixel box reprojected to layer CRS. WCS was modified accordingly to effectively use cache for identify with small context size.

Good to know:

WMS 1.1 specification:
The behavior described above is geared toward the picture case. In the graphic element case, the semantics of GetFeatureInfo are less defined. The intent is to gain experience with this version of the request and perhaps provide additional rigor in future versions of the specification.

The actual semantics of how a WMS decides what to return more information about, or what exactly to return is left up to the WMS provider.

WMS 1.3 specification:
The actual semantics of how a WMS decides what to return more information about, or what exactly to return, are left up to the WMS provider.

UMN Mapserver is using for vector point/line layers features search the pixel specified in request plus buffer around specified by TOLERANCE (layer param).

#27 Updated by Giovanni Manghi about 10 years ago

  • Status changed from Closed to Reopened
  • Target version changed from Future Release - High Priority to Version 2.4

sorry to reopen this, I'm testing again and still see issues:

qgis 2.2 as client

1) qgis server 2.2

identify works for vector layers if otfr is off or if is on but no actual reprojection is made

if otfr is on and layers are reprojected then identify of points and line features does not work. The identify window opens but then the result are empty. Polygons identify seems to work.

2) qgis server 2.2

if I identify a feature and change the mode to "feature" the result is empty (probably because qgis server does not support it, ok). If the user closes the identify window and try identify again then nothing happens and in the bottom left corner of qgis main windows shows a "no features at this position found" message. The is necessary to remove and add again the layer to get the identify work again.

3) mapserver 6.4.1

if otfr is on and layers are reprojected then identify of points features does not work. The message that shows is "no features at this position found", and no window is open. Polygons and lines identify seems to work.

3) mapserver 6.4.1

when identifing on mapserver 6.4.1 (using the default modes "text/plain" and "GML" server side), the attributes show only for the "feature" mode (client side), not for "text".

#28 Updated by Giovanni Manghi about 10 years ago

  • Subject changed from Identify of WMS layers does not work for reprojected point and line layers to Identify of WMS layers does not work

qgis 2.3 as client

1) mapserver 6.4.1

identify does not work in any case, with any kind of features

2) qgis server 2.2

identify works for vector layers if otfr is off or if is on but no actual reprojection is made

if otfr is on and layers are reprojected then identify of points and line features does not work. The identify window opens but then the result are empty. Polygons identify seems to work.

#29 Updated by Giovanni Manghi about 10 years ago

I do not have time to test also rasters... but it would be needed because it was an issue in the past (wrong pixel value for reprojected wms layers) and it could be again.

#30 Updated by Radim Blazek about 10 years ago

Giovanni Manghi wrote:

3) mapserver 6.4.1

when identifing on mapserver 6.4.1 (using the default modes "text/plain" and "GML" server side), the attributes show only for the "feature" mode (client side), not for "text".

GetFeatureInfo response for text/plain is not empty?

Regarding points/lines with OTFR. The WMS GetFeatureInfo does not work with a coordinate in CRS, it works with extent + width/heigh + pixel coordinate within that extent. We call the extent + width/height a context in QGIS. If OTFR is on, QGIS is using as extent a single pixel size rectangle around the point reprojected to WMS source CRS. Because it is known, that Mapserver does not work with 1x1, the WMS provider adds another pixel in width and height. That was working with 6.0.3. Not sure if Mapserver changed or it is not always sufficient.

Could you try to take the GetFeatureInfo request and modify it by hand and test in browser adding more pixels around the point to find what buffer around the point is necessary?

Another thing to test is TOLERANCE param in mapfile.

#31 Updated by Radim Blazek almost 10 years ago

Is it available a public server for testing?

Which source data and client CRS?

#32 Updated by Radim Blazek almost 10 years ago

Regarding QGIS WMS server, it has no sense to do any debugging on client side until #9896 (GetFeatureInfo search radius) is resolved.

#33 Updated by aperi2007 - almost 10 years ago

You can use this public server.

http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsambamm

Use the Layer
rt_ambamm.idcomuni.rt.poly

The original source is in EPSG::3003

you can request in wms 1.1.1 or wms 1.3.0

the available CRS are:
EPSG:25832 EPSG:3003 EPSG:4326 EPSG:3857 EPSG:32632

To test this ticket I suggest you try to identify near a boundary better if it is a boundary of three polygons,
so you can see better if the result is on a polygon or in the near polygon.

Also
this is a sample of request getfeatureinfo:

http://www502.regione.toscana.it/wmsraster/com.rt.wms.RTmap/wms?map=wmsambamm&language=ita&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=1617043.371614,4810657.326353,1617576.552829,4810931.280957&CRS=EPSG:3003&WIDTH=581&HEIGHT=437&LAYERS=rt_ambamm.idcomuni.rt.poly&STYLES=&FORMAT=image/png&QUERY_LAYERS=rt_ambamm.idcomuni.rt.poly&FEATURE_COUNT=10&INFO_FORMAT=text/html&I=240&J=200

The request is a standard wms 1.3.0 request. It ask for a BOX with a declared coordinate of 1617043.371614,4810657.326353,1617576.552829,4810931.280957 in epsg:3003.
Most important are the parameter I & J they are the point in pixel unit in the declared box where the mause click on the GIS client.

In this request , the response return an html page but in the superior part of it you can see the coordinate in epsg:3003 and in geographics.
So you can compare it with your results.

A.

#34 Updated by Radim Blazek almost 10 years ago

  • Status changed from Reopened to Feedback

I tested rt_ambamm.idcomuni.rt.poly with EPSG: 4326, 3857, 3003, 25832, 32632, 4326 reprojected to 3857 and 3857 reprojected to 4326 with html format and all works correctly for me.

Can you please specify exactly which EPSG use for the layer and for the project to reproduce the error?

#35 Updated by Giovanni Manghi almost 10 years ago

testes were made adding the layers in a projected CRS (3763, is the one defined for the layers) and then reprojecting to WGS84. The dataset (and projects and mapfiles) will be sent privately.

vectors

1) qgis 2.2/master as client, qgis 2.2 as server

http://148.251.4.143/cgi-bin/qgis_mapserv.fcgi?map=/home/gmanghi/public_html/testes_wms/project_qgis_22_vectors.qgs

Identify works for vector layers if otfr is OFF or if is ON, but no actual reprojection is made

If otfr is ON and layers are reprojected then identify of points and lines features does not work. The identify window opens but then the result are empty. Polygons identify works.

2) qgis 2.2/master as client, qgis 2.2 as server

http://148.251.4.143/cgi-bin/qgis_mapserv.fcgi?map=/home/gmanghi/public_html/testes_wms/project_qgis_22_vectors.qgs

if I identify a feature and change the mode to "feature" the result is empty (probably because qgis server does not support it, ok). If the user closes the identify window and try identify again then nothing happens and in the bottom left corner of qgis main windows shows a "no features at this position found" message. Then is necessary to remove and add again the layer to get the identify work again.

3) qgis 2.2 as client, mapserver 6.4.1 as server

http://148.251.4.143/cgi-bin/mapserv?map=/home/gmanghi/public_html/testes_wms/project_mapserver_641_vectors.map

TOLERANCE helps a lot for points and lines.

With reprojection OFF or ON identify is ok but only for "feature" mode (I have not tested to configure the HTML response server side, but I assume is ok).

"Text" mode always return no attributes, but this may not be a QGIS issue after all, in fact here

http://mapserver.org/ogc/wms_server.html#setup-a-mapfile-for-your-wms

there is an example where the text getfeatureinfo does not work too

http://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-11.332970,24.121208,47.584718,57.965035&SRS=EPSG:4326&WIDTH=1001&HEIGHT=575&LAYERS=cities&STYLES=&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=cities&INFO_FORMAT=text/plain&X=229&Y=280

while html/gml are ok

http://demo.mapserver.org/cgi-bin/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-11.332970,24.121208,47.584718,57.965035&SRS=EPSG:4326&WIDTH=1001&HEIGHT=575&LAYERS=cities&STYLES=&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=cities&INFO_FORMAT=text/html&X=229&Y=280

4) qgis master as client, mapserver 6.4.1 as server

http://148.251.4.143/cgi-bin/mapserv?map=/home/gmanghi/public_html/testes_wms/project_mapserver_641_vectors.map

Identify does not works at all, regardless if reprojection in OFF or ON, it always returns "no features at this position found".

rasters

1) qgis 2.2/master as client, qgis 2.2 as server

http://148.251.4.143/cgi-bin/qgis_mapserv.fcgi?map=/home/gmanghi/public_html/testes_wms/project_qgis_22_rasters.qgs

Identify works ok regardless if otfr in OFF or ON.

2) qgis 2.2/master as client, mapserver 6.4.1 as server

http://148.251.4.143/cgi-bin/mapserv?map=/home/gmanghi/public_html/testes_wms/project_mapserver_641_rasters.map

Identify works ok regardless if otfr in OFF or ON.

#36 Updated by Etienne Tourigny almost 10 years ago

Giovani - can you please test that the identify tool plugin works with wms rasters?

#37 Updated by Giovanni Manghi almost 10 years ago

Etienne Tourigny wrote:

Giovani - can you please test that the identify tool plugin works with wms rasters?

it is a python plugin available in the plugin repo?

#38 Updated by Radim Blazek almost 10 years ago

Giovanni Manghi wrote:

testes were made adding the layers in a projected CRS (3763, is the one defined for the layers) and then reprojecting to WGS84. The dataset (and projects and mapfiles) will be sent privately.

Giovanni, thanks for exhaustive and well documented tests, I'll try to address all remaining problems.

vectors

1) qgis 2.2/master as client, qgis 2.2 as server

http://148.251.4.143/cgi-bin/qgis_mapserv.fcgi?map=/home/gmanghi/public_html/testes_wms/project_qgis_22_vectors.qgs

Identify works for vector layers if otfr is OFF or if is ON, but no actual reprojection is made

If otfr is ON and layers are reprojected then identify of points and lines features does not work. The identify window opens but then the result are empty. Polygons identify works.

Until the QGIS mapserver GetFeatureInfo search radius is fixed (#9896), it is useless to debug the client.

2) qgis 2.2/master as client, qgis 2.2 as server

http://148.251.4.143/cgi-bin/qgis_mapserv.fcgi?map=/home/gmanghi/public_html/testes_wms/project_qgis_22_vectors.qgs

if I identify a feature and change the mode to "feature" the result is empty (probably because qgis server does not support it, ok). If the user closes the identify window and try identify again then nothing happens and in the bottom left corner of qgis main windows shows a "no features at this position found" message. Then is necessary to remove and add again the layer to get the identify work again.

There were two problems:

  • Feature format was not working at all probably since JSON support introduction, see also #10306, fixed in be318fe6
  • QGIS server is using rather particular GML flavour, support added in c00bcb1b

3) qgis 2.2 as client, mapserver 6.4.1 as server

http://148.251.4.143/cgi-bin/mapserv?map=/home/gmanghi/public_html/testes_wms/project_mapserver_641_vectors.map

TOLERANCE helps a lot for points and lines.

With reprojection OFF or ON identify is ok but only for "feature" mode (I have not tested to configure the HTML response server side, but I assume is ok).

"Text" mode always return no attributes, but this may not be a QGIS issue after all

There are no attributes because your project_mapserver_641_vectors.map is missing

"wms_include_items"   "all" 

in layers METADATA.

4) qgis master as client, mapserver 6.4.1 as server

http://148.251.4.143/cgi-bin/mapserv?map=/home/gmanghi/public_html/testes_wms/project_mapserver_641_vectors.map

Identify does not works at all, regardless if reprojection in OFF or ON, it always returns "no features at this position found".

"Feature" format was broken, it should be fixed, see #10306. For me it works with current master.

I hope that all the problems are resolved, please verify and close if it works for you.

#39 Updated by Giovanni Manghi almost 10 years ago

There are no attributes because your project_mapserver_641_vectors.map is missing
[...]
in layers METADATA.

of course, sorry for that.

#40 Updated by Etienne Tourigny almost 10 years ago

Giovanni Manghi wrote:

Etienne Tourigny wrote:

Giovani - can you please test that the identify tool plugin works with wms rasters?

it is a python plugin available in the plugin repo?

yes, it's one of the most popular plugins

there is a mention in this ticket that wms layers are not identified.
#4536

Radim: as you have been working on the value tool plugin before, can you test it? I don't know enough about WMS to be helpful.

#41 Updated by Radim Blazek almost 10 years ago

Isn't it disabled in ValueTool for WMS? It should be.

The ValueTool prints value for each pixel the mouse moves over. For WMS it would mean to send a request for each pixel. If you move the mouse over the whole canvas it could mean thousands of requests in a second....

#42 Updated by Etienne Tourigny almost 10 years ago

wow didn't think about that... but I added a "mouse click" option, I'll see if I can enable identify for wms layers when this option is enabled. Thanks for the info.

#43 Updated by Radim Blazek almost 10 years ago

  • Status changed from Feedback to Closed

Ticket fixed with funding from Regione Toscana-SITA (CIG:ZB10C90E5A).

Also available in: Atom PDF