I am trying to to create a spatial view on my spatialite database.

        CREATE VIEW v2_pump_view AS
          SELECT pump.ROWID AS ROWID, pump.id AS pump_id,
                 start_node.the_geom, end_node.the_geom
                 ) AS the_geom
          FROM v2_pump AS pump
          , v2_connection AS start_node
          , v2_connection AS end_node
          where pump.connection_start_id = start_node.id
          AND pump.connection_end_id = end_node.id

Then, to register with the views_geometry_columns:

    INSERT INTO views_geometry_columns
    (view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
    VALUES ('v2_pump_view', 'the_geom', 'ROWID',
        'v2_connection', 'the_geom');

Of course this doesn't work as the connection table has a point geometry. How I can register the line-geometry I made on the fly during the view creation by the MakeLine-function?

  • AFAIK you can't. A view can only refer to a real geometry column in the spatial table it is based on. – Micha Aug 24 '15 at 12:27
  • which can be empty? then i could add another column to connection, make it a line geometry and would use it to register the view... – LarsVegas Aug 24 '15 at 13:45
  • Is there any reason not to just make a real table of line features? – Micha Aug 25 '15 at 17:06

Your Answer

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

Browse other questions tagged or ask your own question.