Create grids for the given shapefile¶
First we will import all the required dependencies
In [21]:
Copied!
from rasvec import create_grid_on_vector
import geopandas as gpd
from rasvec import create_grid_on_vector
import geopandas as gpd
In [23]:
Copied!
gdf = gpd.read_file(r"sample_data/vector/vec/vec.shp")
gdf.plot()
gdf = gpd.read_file(r"sample_data/vector/vec/vec.shp")
gdf.plot()
Out[23]:
<Axes: >
In [24]:
Copied!
grid_cells = create_grid_on_vector("sample_data/vector/vec/vec.shp", 1000, "grid.shp")
grid_cells = create_grid_on_vector("sample_data/vector/vec/vec.shp", 1000, "grid.shp")
In [25]:
Copied!
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10, 10))
gdf.plot(ax=ax)
grid_cells.plot(ax=ax, facecolor="none", edgecolor="red")
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize=(10, 10))
gdf.plot(ax=ax)
grid_cells.plot(ax=ax, facecolor="none", edgecolor="red")
Out[25]:
<Axes: >