[qgis-qwc2] make datasource searchable II

torstenwolf at t-online.de torstenwolf at t-online.de
Fri Dec 13 06:46:23 PST 2019


Dear all,
 
as my previous post collects views but no answers I want to share my gained 
knowledge with you and set up a new question.
 
The biggest surprise for me was QWC2 search function uses the same 
functions as the original QWC (or may be not....?), My thinking of: New 
Client means new seach providers and functions was wrong. 
 
This post was very helpul: 
http://osgeo-org.1560.x6.nabble.com/Address-Search-td5389157.html 
<http://osgeo-org.1560.x6.nabble.com/Address-Search-td5389157.html>   
(first 2 paragraphs).
 
Actualy a good notice as the "old" search function setup is well documented 
in QWC-github (https://github.com/qgis/QGIS-Web-Client/tree/master/wsgi
<https://github.com/qgis/QGIS-Web-Client/tree/master/wsgi> ). I choose the 
wsgi-way so the chapter 6.2.xx gave the information. At the POSTGIS-side I 
use searchviews.
 
Meanwhile I upgraded my server to Debian buster with Apache 2.4.38 and use 
all Debian-provided modules (e.g. libapache2-mod-wsgi). As long as you can 
make sure the Python2.7-environment handles the search.wsgi.script there is 
in the end no big problem to generate a new virtual host with the 
wsgi-functionality. For testing purpose I set /etc/hosts to "127.0.0.1 
wsgi.myhiddendomain.com wsgi" and that works well.
 
A very good source to deal with wsgi-problems is this one: 
https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html
<https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html>
 
Unfortunately all my stuff is behind a firewall so I have to post my 
settings.
 
Generating a web-request to my wsgi-host with:
 
http://wsgi/wsgi/search.wsgi?searchtables=boreholesearchview&query=423C-3003
<http://wsgi/attributsuche?searchtables=intern.geodin&query=423C-3003>
 
produces this fine result:
 
{"results": [{"searchtable": null, "displaytext": "Bohrpunkte GeOdin: ", 
"bbox": null, "showlayer": "Daten aus fis_re_bohrpunktegeo"}, 
{"searchtable": "boreholesearchview", "displaytext": "423C-3003 von 1910 
auf 35m: 7m Tiefe", "bbox": [387946.19,5820458.8,387946.19,5820458.8], 
"showlayer": "Daten aus fis_re_bohrpunktegeo"}]}
 
This very similar to examples given by the "uster"-team (see 
js/SearchProvider.js for details) in their web-posts and my test runs with 
their search machine.
 
I altered the original search.wsgi in line 132 and 134 to avoid the (in my 
eyes useless) "selectable"-entry.
 
Using the Swisstopo-search-engine (provided in js/SearchProviders.js too 
and enabled in themesConfig.json) is currently the only way to enable a 
search funtionality as it is desired for the borehole data.
 
request:
http://api3.geo.admin.ch/rest/services/api/SearchServer?searchText=Naturfreundehaus%20Grindelwald&type=locations&limit=20
<http://api3.geo.admin.ch/rest/services/api/SearchServer?searchText=Naturfreundehaus%20Grindelwald&type=locations&limit=20>
answer:

{"results":[{"id":100816,"weight":3,"attrs":{"origin":"gazetteer","geom_quadindex":"021333000031220311132","zoomlevel":4294967295,"lon":8.035799980163574,"detail":"grindelwald, naturfreundehaus haltestelle bus","rank":8,"geom_st_box2d":"BOX(645731.809781232 164339.237855834,645731.809781232 164339.237855834)","lat":46.62873840332031,"num":1,"y":645731.8125,"x":164339.234375,"label":"<i>Bus</i> <b>Grindelwald, Naturfreundehaus</b>"}}]}

Studying the function geoAdminLocationSearch (in js/SearchProviders.js) I learned their "stripping" (using "only" 'BOX' as 'bbox', 'label' as 'displaytext' and '"origin":"gazetteer"' for group generating) of the answer in a way qwc2 can understand and place a hit in the map.

As I'm not a developer I can only play around with the provided code examples but I didn't found out how to set up the things for my case.

So I hope the "old" search functions of QWC can deal with QWC2 needs and I still hope somebody knows and tell the way to do it.

regards

Torsten



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-qwc2/attachments/20191213/ce0b80de/attachment.html>


More information about the qgis-qwc2 mailing list