5 Dec 2014

QspatiaLite Use Case: Get Subselection of Grid which Covers Polygon

Here's another short SQL-query which I used to get a subselect from a rectengular grid. Aim is to keep only the grid-cells that fully cover the area of a second polygon-layer - cells which do not overlap the polygon's area completely will be skipped from the new grid-layer.

select 
  g.*
from(select Gunion(geometry) as geom
           from MYPLGN) as u, grid as g
where area(intersection(g.geometry, u.geom)) = area(g.geometry)

No comments :

Post a Comment