On Mon, 24 Oct 2016 08:11:04 -0700 (PDT), Paulo Eduardo Cardoso wrote:
> I'm convinced that: 1) Spatial Views can only be create when original
> geometry is no changed and 2) Spatial View may not be suited to
> create
> dynamic layer (that will adjust when reference layer change).
>
Hi Paulo Eduardo,
both your assumptions are actually true, and here is a short
rationale explaining why.
1. many Desktop GIS applications (QGIS for first) pretend to
known in advance the exact Type (= Class) of all Geometries
expected to be stored into a layer.
unhappily many Spatial Operators could eventually return
different types depending on their input values and arguments;
just to say, ST_Buffer() will usually return a mix of Polygons
and Multipolygons, but under some exceptional condition
(e.g. radius = zero) it could even return Point/Multipoint
or Linestring/Multilinestring.
and in some rare case we can also expect to get out some
GeometryCollection (a "forbidden" Type absolutely unsupported
by many GIS applications, as e.g. QGIS).
short conclusion: there is no way to guess in advance the
exact Geometry Type returned by dynamically calling a Spatial
Operator on behalf of unknown data; querying the whole dataset
is the only way to safely determine the actual Geometry Type
returned by an arbitrary, unqualified View.
Unhappily this one is an intrinsically costly operation,
and could easily end up in very sluggish performances when
your input dataset contains a lot of features.
definitely not a good access strategy.
2. you can expect to get decent (= fast) performances on any
Desktop GIS application only when each layer is effectively
supported by some kind of Spatial Index (except when you
are just kidding on some toy dataset containing a very
limited number of features).
Unfortunately there is no way to build a Spatial Index
capable to support a dynamic View returning random values;
but querying a large layer not supported by any Spatial
Index will surely cause a deadly slowness.
Conclusion: SpatiaLite will accept as a valid Spatial View
only the ones satisfying the following conditions:
a) all geometries must be stored as fixed, immutable column
values. and consequently could never be the dynamic result
of some Spatial Operator.
b) all geometries must keep exact trace of the DB table
from there they come and of the corresponding ROWID,
so to allow querying an eventual Spatial Index.
bye Sandro