Tuesday 17 May 2016

spatialite - Polygon intersection using QGIS virtual layers


I'm trying to intersect polygon geometries in QGIS by using a virtual layer:


SELECT
sbqry.rowid AS gid,
sbqry.geom
FROM
(SELECT
ST_Intersection(land_parcels.geometry, flood_zone.geometry) AS geom

FROM land_parcels, flood_zone
WHERE ST_Intersects(land_parcels.geometry, flood_zone.geometry) AND NOT ST_Touches(land_parcels.geometry, flood_zone.geometry))
AS sbqry;

Unfortunately, sbqry.rowid AS gid returns NULL instead of auto-incrementing values.


enter image description here enter image description here


Does anybody know how to create an unique identifier column named 'gid'? As far as I know virtual layers are based on SQLite/Spatialite.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...