title: Deleting Non-Intersecting Geometries in PostGIS
body: <p>I am working with geo spatial data (quite big one). Now the large data polygons are distributed on the map and i need to sub divide the area of interests (Where i have data) into tiles to further work on them.
  Currently i am using postgis method ST_Square that creates the polygons of required size. Command to create tiles in postgis</p>
  <pre><code>ST_SquareGrid(0.2,geom)
  </code></pre>
  <p>geom is the polygon that i need to sub devide and 0.2 is the size in meters in which i am creating the tiles. I am using the projection 3857.</p>
  <p>This functions seems to work completely fine until i found that its creating tiles for the area where no data is available. As shown in the image below. Only 3 squares should be there as 4th square does not have any data in it.</p>
  <p>Can you help me control this so that it only creates the tiles where data is presents and avoid creating empty tiles.</p>
  <p><a href="https://i.stack.imgur.com/7FWv0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7FWv0.png" alt="enter image description here" /></a></p>
  <p>(The solution can be in GeoDjango or PostGis)</p>