An implementation of the ESA Major Tom Grid
pip install majortom_eg
import shapely.geometry
from shapely.io import to_geojson
from majortom_eg import MajorTomGrid, GridCell
# generate an overlapping grid with cells of 320m square
grid = MajorTomGrid(d=320, overlap=True)
# polygon 1/10 of a degree square
my_aoi = shapely.geometry.Polygon(((0., 0.), (0., 0.1), (0.1, 0.1), (0.1, 0.), (0., 0.)))
# iterate of cells returned from generator
for cell in grid.generate_grid_cells(my_aoi):
# do something with cells
print(f'cell id is {cell.id()}')
print(f'cell geom is {to_geojson(cell.geom)}')
majortom
is distributed under the terms of the MIT license.