1

Creating a dynamic buffer with PostGIS the following view is working:

CREATE VIEW buffer500m AS
SELECT gid, st_buffer(geom,500)::geometry(polygon,31492) AS geom
FROM point;

Unfortunately this query gives an error using a SpatiaLite database (unrecognized token: ":").

So I've tried

   CREATE VIEW buffer500m AS
   SELECT gid, st_buffer(geom,500) AS geom
   FROM point;

and

   CREATE VIEW buffer500m AS
   SELECT gid, buffer(geom,500) AS geom
   FROM point;

but with both queries the geometry and the CRS are missing in the view. Can anyone help me?

  • 1
    IIUC a spatial view in Spatialite must have a real, existing geometry column, not something that's created in the query. – Micha Apr 18 '15 at 9:17
2

Accordingly to Spatialite coockbook you must register your VIEW into the views_geometry_columns, so to make it become a real Spatial View, i.e.:

INSERT INTO views_geometry_columns
    (view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
  VALUES ('buffer500m', 'geometry', 'ROWID', 'point', 'geom');
|improve this answer|||||
  • Unfortunately this isn't working. There is still no geometry in the geom column. – Lunar Sea Apr 17 '15 at 21:48
2

Try register your VIEW this manner:

INSERT INTO views_geometry_columns
    (view_name, view_geometry, view_rowid, f_table_name, f_geometry_column, read_only)
  VALUES ('buffer500m', 'geometry', 'ROWID', 'point', 'geom', 1);

read_only option boolean 1 for read only VIEW - read_only option boolean 0 for updatable VIEW.

In Spatialite Cookbook not consign this option.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.