3nids / quickfinder

Quick Finder is a QGIS 2.x plugin offering a single place to perform searches on project layers and online remote services
http://3nids.github.io/quickfinder/
Other
8 stars 14 forks source link

PostGIS finder #61

Closed pka closed 7 years ago

pka commented 7 years ago

This pull request adds a finder for user defined PostGIS queries. The queries are stored in the QGIS settings and projects can reference these search queries.

Sample query:

SELECT textfield, ST_AsBinary(wkb_geometry)::geometry
  FROM searchtable
  WHERE textfield LIKE %(search)s
  LIMIT %(limit)s
pka commented 7 years ago

Any chance to look at this PR?

pka commented 7 years ago

Hi Denis,

Thanks for looking at the PR.

Query generation I decided against query generation wtih the following reasons:

  1. We often use stored procedures for complex searches and this changes the SQL in different places
  2. The comparison operator can be different, e.g. =, LIKE, @@, etc.
  3. When doing FTS comparisons an ORDER BY expression is usually needed

Category field Each Query is used as category. The Search Name is displayed as category name

WKB/WKT choice Do you see a use case for returning WKT from a PostGIS query?

SRID widget Done

NameError exception This exception is caused by the following import: from processing.tools.postgis import uri_from_name, DbError Either your Processing is to old or to new? I've improved the handling of this case.

3nids commented 7 years ago

hi @pka I gave it a try today, and could not use because apparently I could not load processing.tools.postgis. Do you have any idea what is the issue? (I could load processing.tools, the postgis.py file is in there...)