I am quite new to Python and I need to create a custom grid with a specific spacing on a Folium map for a particular district. I have added the Polygon of district boundary on the folium map.
The grid spacing should be set to 7 km in the x-direction and 5.5 km in the y-direction.
I have written the following code but I am stuck at that.
Is there any library for creating the grids?
import folium
from shapely.geometry import Polygon
import geopandas as gpd
District boundary polygon
district_polygon
Create a GeoDataFrame with the polygon as the geometry column
district_gdf = gpd.GeoDataFrame(geometry=[district_polygon])
Set the CRS for the entire GeoDataFrame
district_gdf.crs = {'init': 'epsg:4326'}
Defining the size of the grid cells in decimal degrees
grid_size_lat = 0.063 # roughly 7km at the equator
grid_size_lon = 0.0505 # roughly 5.5km at the equator
Get the bounds of the district boundary polygon
minx, miny, maxx, maxy = district_gdf.total_bounds
Create empty lists to store grid cell geometries
grid_cells = []
