3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
257 stars 143 forks source link

[Bug]: postgresql search bar shows no results (but response from server does) #3432

Open tbnobody opened 1 year ago

tbnobody commented 1 year ago

What is the bug?

If I enter something in the search field a message pops up and shows no results: grafik

If I look at the Network Analysis Tab in the Developer Tools I see that the API endpoint is returning values: grafik

There are no errors in the Javascript console

Steps to reproduce the issue

See above

Versions

Versions :

Check Lizmap plugin

QGIS server version, only if the section above doesn't mention the QGIS Server version

No response

Operating system

Debian Bullseye

Browsers

Firefox

Browsers version

Firefox 109

Relevant log output

No response

Gustry commented 1 year ago

Strange, I just tried on 3.6.1, it works as expected, and this feature is covered by a test https://github.com/3liz/lizmap-web-client/blob/master/tests/end2end/cypress/integration/lizmap_search-ghaction.js

tbnobody commented 1 year ago

Do you know how to debug this any further? Does the item_layer have to match any of the layers in the qgis project? (Currently it does, but I also tried a different one). Is there anything special what I have to setup in the qgis project itself?

tbnobody commented 1 year ago

I've just figured out that this line returns false: https://github.com/3liz/lizmap-web-client/blob/28916d34bd85d0b588a1c9a347104277363d05f6/lizmap/www/js/search.js#L117 And therefor no result is added to the found items.

I added a debug output to the console and logged bbox as the first object and extent as the second one:

Object { left: 7.7, bottom: 47.3, right: 7.7, top: 47.3 }
Object { left: 179.99999999990337, bottom: -85.05112877981495, right: -179.99999999990337, top: 85.05112877981493, centerLonLat: null }

If I edit the above mentioned line to if ( true || extent.intersectsBounds(bbox) ) { it works as expected. Not sure what I am doing wrong that the intersectsBounds method returns false.

tbnobody commented 1 year ago

After some additional research, it seems that the coordinates of the extent object left and right are swapped. left should be -179 and right should be 179

tbnobody commented 1 year ago

Ok fixed it... The reason was, that in QGIS the following max extent coordinates where entered in the QGIS server Properties: Object { left: -20037508.3428, bottom: -20037508.3428, right: 20037508.3428, top: 20037508.3428 } Coordinate system was EPSG:3857

When this coordinates where converted to EPSG:4326 the result was: Object { left: 179.99999999990337, bottom: -85.05112877981495, right: -179.99999999990337, top: 85.05112877981493, centerLonLat: null }

I've now changed the extent coordinates in QGIS to: Object { left: -20037508.3400, bottom: -20037508.3400, right: 20037508.3400, top: 20037508.3400 }

and the 4326 coordinates are correct: Object { left: -179.99999997494382, bottom: -85.05112877764509, right: 179.99999997494382, top: 85.05112877764508, centerLonLat: null }

Not sure whether this is still an issue of lizmap or qgis but from my side this issue could also be closed if it's an user error.

Gustry commented 1 year ago

QGIS 3.28 has the new UI widget extent selector in the QGIS server properties, right ?

Did you spot an issue from the QGIS server properties dialog ?

I've now changed the extent coordinates in QGIS to:

You mean you have changed in QGIS desktop but you are printing the result from JS ?

tbnobody commented 1 year ago

You mean you have changed in QGIS desktop but you are printing the result from JS ?

Thats right... in QGIS it looks now as follow: grafik Previously the .3400 was .3428

rldhont commented 1 year ago

It seems that the EPSG:3857 max extent is -20037508.34, -20048966.1, 20037508.34, 20048966.1 corresponding to -180.0, -85.06, 180.0, 85.06 so -20037508.3428 is the day before.