Grids

grid generators

SquareGridGenerator

This gridding approach creates equally spaced grids relative to the bounding box of the AOI. The grid spacing is defined by cell_size


source

SquareGridGenerator

 SquareGridGenerator (cell_size:float, grid_projection:str='EPSG:3857', bo
                      undary:Union[__main__.SquareGridBoundary,List[float]
                      ,Tuple[float]]=None)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
cell_size float height and width of a square cell in meters
grid_projection str EPSG:3857 projection of grid output
boundary Union None original boundary

source

SquareGridGenerator.create_cell

 SquareGridGenerator.create_cell (x:float, y:float)

Create a square cell based on the bottom left coordinates and cell_size

Type Details
x float x coord of bottom left
y float y coord of bottom left
Returns Polygon

source

SquareGridGenerator.create_grid_for_polygon

 SquareGridGenerator.create_grid_for_polygon (boundary, geometry)

source

SquareGridGenerator.generate_grid

 SquareGridGenerator.generate_grid
                                    (aoi_gdf:geopandas.geodataframe.GeoDat
                                    aFrame)

FastSquareGridGenerator

This gridding approach creates equally spaced grids relative to the bounding box of the AOI. The grid spacing is defined by cell_size

This is significantly faster than SquareGridGenerator

This uses these optimizations to speed up grid generation:

  1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.
  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()

This also does error correction on the polygon boundary using off-boundary pixels. Read more in the polygon fill module reference


source

FastSquareGridGenerator

 FastSquareGridGenerator (cell_size:float,
                          grid_projection:str='EPSG:3857', boundary:Union[
                          __main__.SquareGridBoundary,Iterable[float]]=Non
                          e)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
cell_size float height and width of a square cell in meters
grid_projection str EPSG:3857 planar projection of grid
boundary Union None original boundary

source

FastSquareGridGenerator.generate_grid

 FastSquareGridGenerator.generate_grid
                                        (aoi_gdf:geopandas.geodataframe.Ge
                                        oDataFrame,
                                        unique_id_col:Optional[str]=None)
Type Default Details
aoi_gdf GeoDataFrame
unique_id_col Optional None the ids under this column will be preserved in the output tiles
Returns Union

H3GridGenerator


source

H3GridGenerator

 H3GridGenerator (resolution:int, return_geometry:bool=True)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
resolution int Resolution of hexagon. See: https://h3geo.org/docs/core-library/restable/ for more info
return_geometry bool True If geometry should be returned. Setting this to false will only return hex_ids

source

H3GridGenerator.get_hexes_for_polygon

 H3GridGenerator.get_hexes_for_polygon
                                        (poly:shapely.geometry.polygon.Pol
                                        ygon)

source

H3GridGenerator.generate_grid

 H3GridGenerator.generate_grid
                                (aoi_gdf:geopandas.geodataframe.GeoDataFra
                                me)

BingTileGridGenerator


source

BingTileGridGenerator

 BingTileGridGenerator (zoom_level:int, return_geometry:bool=True,
                        add_xyz_cols:bool=False)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
zoom_level int Zoom level of tile. See: https://docs.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system for more info
return_geometry bool True If geometry should be returned. Setting this to false will only return quadkeys
add_xyz_cols bool False If quadkey should be converted to their xyz values.

source

BingTileGridGenerator.get_all_tiles_for_polygon

 BingTileGridGenerator.get_all_tiles_for_polygon
                                                  (polygon:shapely.geometr
                                                  y.polygon.Polygon)

Get the interseting tiles with polygon for a zoom level. Polygon should be in EPSG:4326


source

BingTileGridGenerator.generate_grid

 BingTileGridGenerator.generate_grid
                                      (aoi_gdf:geopandas.geodataframe.GeoD
                                      ataFrame)

source

BingTileGridGenerator.generate_grid_join

 BingTileGridGenerator.generate_grid_join
                                           (aoi_gdf:geopandas.geodataframe
                                           .GeoDataFrame,
                                           filter:bool=True, n_workers=4,
                                           progress=True)

FastBingTileGridGenerator

This is significantly faster than BingTileGridGenerator

This uses these optimizations to speed up grid generation:

  1. Vectorized Translation Functions: Functions that translate between lat,lon and x,y are written in polars.
  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()

This also does error correction on the polygon boundary using off-boundary pixels. Read more in the polygon fill module reference


source

FastBingTileGridGenerator

 FastBingTileGridGenerator (zoom_level:int, return_geometry:bool=True,
                            add_xyz_cols:bool=False)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
zoom_level int Zoom level of tile. See: https://docs.microsoft.com/en-us/bingmaps/articles/bing-maps-tile-system for more info
return_geometry bool True If geometry should be returned. Setting this to false will only return quadkeys
add_xyz_cols bool False If xyz columns should be returned. Unlike BingTileGridGenerator, choosing to return xyz columns doesn’t substantionally add compute time.

source

FastBingTileGridGenerator.generate_grid

 FastBingTileGridGenerator.generate_grid
                                          (aoi_gdf:geopandas.geodataframe.
                                          GeoDataFrame, unique_id_col:Opti
                                          onal[str]=None)
Type Default Details
aoi_gdf GeoDataFrame
unique_id_col Optional None the ids under this column will be preserved in the output tiles
Returns Union