Hallo Andreas,

seems to be related with http://hub.qgis.org/issues/3959

the proposed double \\ works

this also worked for me:
was: ... 'BOX\(|\)','','g'),' ',',')||']'::text AS bbox ...
now: ... 'BOX[(]|[)]','','g'),' ',',')||']'::text AS bbox ...

found the hint in the first user comment at http://www.postgresql.org/docs/8.4/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP

standard_conforming_strings is not set in my postgresql.conf (PostgreSQL 8.4)

as we are into wsgi there are more questions (I have no clue about wsgi, but did some QGIS-extensions in Python):

1) why do you use psycopg2 instead of QtSql (additional installation needed as PyQt4 is installed because of QGIS anyhow)?

2) I got a runtime error because the try - except clauses in both scripts do continue even if the try is unsuccessful, e.g. the conn object is undefined if psycopg2.connect is unsuccessful. IMHO the rest of the code must go into the try block or the except block must return. What happens with the string errorText? Is it dumped in some logfile?

3) Documentation says the search table is supposed to have a field searchstring_tsvector (type tsvector) but it is not used, instead searchstring::tsvector is used!
I experimented with tsvector; the WHERE clause in search.wsgi which reads
"searchstring::tsvector @@ lower('"+querystrings[j]+":*')::tsquery"

This works fine if you have a street name like 'Am alten Gaswerk':
select 'Am alten Gaswerk'::tsvector  @@ 'Gaswerk'::tsquery returns true
select 'Am alten Gaswerk'::tsvector  @@ 'Am'::tsquery returns true

BUT
select 'Karl-Marx-Allee'::tsvector  @@ 'Marx'::tsquery returns false
select 'Karl-Marx-Allee'::tsvector  @@ 'Karl'::tsquery returns false

PostgreSQL provides to_tsvector and to_tsquery functions
select to_tsvector('Karl-Marx-Allee') @@ to_tsquery('Karl')
select to_tsvector('Karl-Marx-Allee') @@ to_tsquery('Marx')
both return true
select to_tsvector('Am alten Gaswerk') @@ to_tsquery('Gaswerk') returns true

BUT
select to_tsvector('Am alten Gaswerk') @@ to_tsquery('Am') returns false :( because Am is skipped by to_tsvector

EVEN WORSE
select to_tsvector('german', 'Über den Teufelslöchern') returns 'teufelsloch':3, a user has to enter quite some characters before the query returns something and if he enters "Teufelslöcher" he won't get any result.

So tsvector is fine for texts skipping all the fill words and reducing nouns to their single form but as we are dealing with place names we do not want this behaviour. We could use PostgreSQL's ILIKE but this would result in a full string comparison and I guess in a lower performance.

My workaround was to use searchstring_tsvector and to use a different language for to_tsvector and to_tsquery: CREATE VIEW ... AS SELECT ... to_tsvector('spanish', stringfield) AS searchstring_tsvector ...
and change search.wsgi accordingly:
searchstring_tsvector @@ to_tsquery(\'spanish\','"+querystrings[j]+":*')

select to_tsvector('spanish', 'Über den TEufelslöchern') @@ to_tsquery('spanish', 'Über') returns true

I can create tickets (and provide patches) for these issues.

Bernhard


Am 28.02.2012 11:42, schrieb Andreas Neumann:
Hi Bernhard,

Ok - I can see some difference in the output of your server and my
server in the bbox format:

Here is the output of my server:
"bbox" : [696321.5, 245623.015625, 696878.875, 246087.875]

and here is the output of your server:
"bbox" : [(4472182.5, 5645202, 4472183, 5645202.5)]

Note the additional round brackets in your output - which I assume that
QGIS webclient cannot digest.
So either the Python script of your server can get rid of these round
brackets or we need to improve QGIS webclient to ignore them. Can you
try on the server first?

If this is not easily possible we can also try on the client.

Hopefully we can improve the situation here in either the search python
script or in the client.

Andreas


On Tue, 28 Feb 2012 10:16:08 +0100, wrote:
Hi Andreas,

the server is currently not available from outside so here is the
wsgi-scripts' output:

http://10.144.9.51/wsgi/search.wsgi?searchtables=kartenportal.suche_alles&query=Am%20alten%20Gaswerk&cb=bla

bla({"results": [{"searchtable": null, "displaytext": "Strassen",
"bbox": null}, {"searchtable": "kartenportal.suche_alles",
"displaytext": "Am alten Gaswerk (Strasse)", "bbox":
[(4471973.5,5645101.5,4472185.5,5645205.5)]}, {"searchtable": null,
"displaytext": "Adressen", "bbox": null}, {"searchtable":
"kartenportal.suche_alles", "displaytext": "Am alten Gaswerk 1
(Adresse)", "bbox": [(4472041,5645209,4472041,5645209)]},
{"searchtable": "kartenportal.suche_alles", "displaytext": "Am alten
Gaswerk 2 (Adresse)", "bbox":
[(4472071.5,5645134.5,4472072,5645135)]}, {"searchtable":
"kartenportal.suche_alles", "displaytext": "Am alten Gaswerk 4
(Adresse)", "bbox": [(4472106,5645099,4472106,5645099)]},
{"searchtable": "kartenportal.suche_alles", "displaytext": "Am alten
Gaswerk 7 (Adresse)", "bbox": [(4472169,5645181,4472169,5645181)]},
{"searchtable": "kartenportal.suche_alles", "displaytext": "Am alten
Gaswerk 7a (Adresse)", "bbox":
[(4472182.5,5645202,4472183,5645202.5)]}, {"searchtable":
"kartenportal.suche_alles", "displaytext": "Am alten Gaswerk 9
(Adresse)", "bbox": [(4472187,5645130.5,4472187.5,5645131)]}]})


http://10.144.9.51/wsgi/getSearchGeom.wsgi?_dc=1330359714648&searchtable=kartenportal.suche_alles&displaytext=Am%20alten%20Gaswerk%20(Strasse)

MULTILINESTRING((4471973.6667815 5645205.155335,4472011.32780392
5645187.04378521,4472168.93332659 5645110.52723776,4472185.36362809
5645101.54646928))

I am using EPSG:31468 (QGIS project's setting, QGIS project's WMS
coordinate system, data srid)
GlobalOption.js - snippet:

//EPSG projection code
var epsgcode = 31468;

// OpenLayers global options
// see

http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Map-js.html

var MapOptions = {
projection: new OpenLayers.Projection("EPSG:"+epsgcode),
units: "m",
maxScale:50,
minScale:150000,
fractionalZoom: true,
transitionEffect:"resize",
controls: []
};

tooltip works now with field named "tooltip"

Bernhard


Am 27.02.2012 22:06, schrieb Andreas Neumann:
Hi Bernhard,

On 02/27/2012 05:22 PM, [email protected] wrote:
Dear all,

I am fiddling around with QGIS server and webclient and I do like both
of them. Thank you for this software!
Whereas QGIS server's configuration is pretty straightforward QGIS
webclient is a higher hurdle.
Here are some questions (more to follow, I am sure :):

1) searchComboBox: I configured two search relations (views): streets
MULTILINESTRING and addresses POINT in my database and they are
searched
ok BUT the map does not zoom in at the feature chosen in the comboBox
although the geometry is highlighted on the map

It really should zoom to the feature. Maybe it is an issue of map scale
or units? What units and scales are you using?

Do you have the search somewhere available to test or can you share a
snippet from the search result?

Here is a valid request on my server and the corresponding result:


http://webgis.uster.ch/wsgi/search.wsgi?query=&searchtables=&query=Hasenb%C3%BCe&cb=stcCallback1003


stcCallback1003({"results": [
{"searchtable": null, "displaytext": "Flurnamen", "bbox":
null},{"searchtable": "av_user.suchtabelle", "displaytext":
"Hasenb\u00fcel (Flurname, Uster)", "bbox":
[696321.5,245623.015625,696878.875,246087.875]},
{"searchtable": "av_user.suchtabelle", "displaytext": "Hinterer
Hasenb\u00fcel (Flurname, Uster)", "bbox":
[696621.375,245924.890625,697073.5,246226.640625]},
{"searchtable": null, "displaytext": "Strassen", "bbox": null},
{"searchtable": "av_user.suchtabelle", "displaytext": "Hinterer
Hasenb\u00fcelweg (Strasse, Uster)", "bbox":
[696699.75,245958.046875,697006.375,246224.640625]},
{"searchtable": "av_user.suchtabelle", "displaytext": "Vorderer
Hasenb\u00fcelweg (Strasse, Uster)", "bbox":
[696454.25,245665.265625,696863.6875,246017.96875]}
]})

2) MapTips: the map tip always shows the layer's name no matter which
field I defined in my layer properties in the project. Or is the
webclient's map tip configured elsewhere?

Currently it is hardwired to a column named "tooltip". You need to
create an attribute or column in your table or view named "tooltip".

Currently there is no way to know which column is set for the maptip.
Later we will take the column name from the QGIS configuration as soon
as QGIS server supports that. The current GetCapabilities request does
not tell us which column is set for map tips. I think this will be
available later this spring as we also want to have the ability to
dynamically set map tips for QGIS client.

Hope this helps,
Andreas

_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail
Server.
http://www.nod32.com

--
Bernhard Ströbl
Anwendungsbetreuer GIS

Kommunale Immobilien Jena
Am Anger 26
07743 Jena

Tel.: 03641 49- 5190
E-Mail: [email protected]
Internet: www.kij.de



Kommunale Immobilien Jena
Eigenbetrieb der Stadt Jena
Werkleiter: Thomas Dirkes


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user


--
Bernhard Ströbl
Anwendungsbetreuer GIS

Kommunale Immobilien Jena
Am Anger 26
07743 Jena

Tel.: 03641 49- 5190
E-Mail: [email protected]
Internet: www.kij.de



Kommunale Immobilien Jena
Eigenbetrieb der Stadt Jena
Werkleiter: Thomas Dirkes


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to