Skip to content

Commit

Permalink
improve documentation on using off-boundary pixels for fast gridding …
Browse files Browse the repository at this point in the history
…error correction
  • Loading branch information
joshuacortez committed Sep 2, 2024
1 parent f1b2f0c commit cb959e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions notebooks/00_grids.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@
"This uses these optimizations to speed up grid generation:\n",
"\n",
"1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.\n",
"2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`"
"2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`\n",
"\n",
"This also does error correction on the polygon boundary using off-boundary pixels. Read more in the [polygon fill module reference](https://geowrangler.thinkingmachin.es/polygon_fill.html)"
]
},
{
Expand Down Expand Up @@ -867,7 +869,9 @@
"This uses these optimizations to speed up grid generation:\n",
"\n",
"1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.\n",
"2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`"
"2. Voxel Traversal and Scanline Fill Algorithms: Faster alternative to finding all pixels within a polygon without using polygon intersection operations. These are implemented in `polygon_fill.fast_polygon_fill()`\n",
"\n",
"This also does error correction on the polygon boundary using off-boundary pixels. Read more in the [polygon fill module reference](https://geowrangler.thinkingmachin.es/polygon_fill.html)"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion notebooks/15_polygon_fill.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@
"source": [
"Notice below that they are the same as the off-diagonal pixels, but filtered to only include pixels on the polygon exterior. We call these off-boundary pixels. These are useful for gridding error correction.\n",
"\n",
"We can determine which pixels to add for error correction by intersecting the polygon boundary linestring with the with the off-boundary tiles. The pixels that intersect should be added back. You can find the implementation in the `generate_grid` method under [FastSquareGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastsquaregridgenerator) and [FastBingTileGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastbingtilegridgenerator)"
"We can't just add all the off-boundary pixels because not all of them actually intersect the polygon in geographic coordinates. We determine which pixels to add for error correction by intersecting the polygon boundary linestring with the off-boundary pixel polygon. Both the linestring and the off-boundary pixel polygon should be in geographic coordinates, not pixel coordinates. The pixels that intersect should be added to the main set of filled pixels. You can find this implementation in the `generate_grid` method under [FastSquareGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastsquaregridgenerator) and [FastBingTileGridGenerator](https://geowrangler.thinkingmachin.es/grids.html#fastbingtilegridgenerator)\n",
" - Despite this step relying on geometry intersection, the performance hit should be relatively small since we're doing a linestring to polygon intersection (not a polygon to polygon intersection), and the off-boundary pixels should be a small fraction of the total pixels."
]
},
{
Expand Down

0 comments on commit cb959e7

Please sign in to comment.