sahrk / DGGRID

A command-line application that generates and manipulates icosahedral discrete global grids.
GNU Affero General Public License v3.0
78 stars 25 forks source link

Increase acceptance rate when using clipping polygons #39

Open MichaelJendryke opened 3 years ago

MichaelJendryke commented 3 years ago

I am generating cells for a specific area by using a Shapefile for clipping.

dggs_res_spec     24
clip_type         POLY_INTERSECT
clip_subset_type  SHAPEFILE
clip_region_files /home/michael/aoi.shp

The polygon used for clipping is actually a lower resolution cell, e.g. resolution 12. Doing so will generate cells of resolution 24 that intersect with the single - resolution 12 - cell. However I noticed, that DGGIRD generates more cells and tests those cells against the clipping polygon. Often the number of cells that are accepted (those that intersect) is very low, decreasing the acceptance rate to less than 10%. How does DGGRID determine the area for which cells are generated for intersection? Is there a way to improve the acceptance rate?

sahrk commented 3 years ago

DGGRID finds the cell (i, j) bounds of the clipping polygon on each quadrilateral it intersects, and then iterates over those cells. This approach was chosen because it works for all grid topologies (in DGGRID triangles, diamonds and hexagons all use Q2DI coordinates), and it generates/outputs the intersected cells in sequence number order.

But as you say, this often leads to a low acceptance rate.

Now that version 7 can find spatial hierarchy children the obvious approach is to cull the cells hierarchically. That is on my todo list. I did look at it a bit, and it looks easy for coarse resolutions, but gets trickier for very high resolutions where it is most useful.