I have 2 layers and I want to make a clip of layer 1 with layer 2 in SpatiaLite (I'm using the DB Manager within QGIS).

That's the code I'm using:

create table clipped_lines as
select * from lines, estensione
where st_intersects(lines.GEOMETRY, extension.geom)

The table is created but it is not a geographical object so I cannot add it to the QGIS map canvas.

The problem (I think) is that the geom column is seen as a normal column and not as a GEOMETRY column. I've tried to update the column with:

ALTER TABLE clipped_lines

but nothing happened.

I thought that the st_intersects function updates automatically the geom column.

  • 1
    What type of geometry is lines (I guess a LINESTRING) and extension (or estensione, whichever one it really is)?
    – BradHards
    Commented Dec 28, 2014 at 23:55
  • Hi @BradHards, yep lines is a LINESTRING while estensione is a MULTIPOLYGON.
    – matteo
    Commented Jan 2, 2015 at 17:48

1 Answer 1


Try to use RecoverGeometryColumn. The syntax is:

SELECT RecoverGeometryColumn('test_geom', 'the_geom',
4326, 'POINT', 'XY');

For more info see http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/new-geom.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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