[Qgis-user] spatialite (and postgis) queries

Jürgen E. Fischer jef at norbit.de
Thu Sep 30 05:27:06 PDT 2010


Hi Carson,

On Thu, 30. Sep 2010 at 13:18:46 +0100, Carson Farmer wrote:
> http://www.carsonfarmer.com/?p=713
> and the RT Sql Layer plugin
> > 1 - Is it possible to build a query where two (or more) layers are
> > involved? Something like:
> >
> > SELECT a.*
> > FROM a, b
> > WHERE Contains(b, a)

and that simple case can be expressed as exists expression in the query builder
(for postgres and spatialite).  Create a layer from a and use following query
string:

	exists (select * from b where contains(b.geom,a.geom))

Creating views is another option (but you still need a unique 32bit integer
primary key for the feature ids, which might be hard to generate in some
cases).


Jürgen

-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-20
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de

-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502




More information about the Qgis-user mailing list