I have a shapefile and I would like the exploded view with GeoPandas in several polygons, I cannot use ArcGIS and keep the polygons that have a given.
import csv
import glob
import time
import sys
import datetime
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Polygon
gdf = gpd.read_file("dossier/essais.shp")
time.sleep(10)
xmin,ymin,xmax,ymax = gdf.total_bounds
lenght = 2065
wide = 3069
cols = list(range(int(np.floor(xmin)), int(np.ceil(xmax)), wide))
rows = list(range(int(np.floor(ymin)), int(np.ceil(ymax)), lenght))
rows.reverse()
polygons = []
for x in cols:
for y in rows:
polygons.append( Polygon([(x,y), (x+wide, y), (x+wide, y+lenght), (x, y+lenght)]) )
grid = gpd.GeoDataFrame({'geometry':polygons}, crs = gdf.crs.to_string())
grid.to_file("dossier/grid.shp")
#df4.head(1000).to_file("dossier/"+file)
gdf.to_file("dossier/grille.shp")