📝 Experimental design for geospatial analytics. To split Polygon geometry into different shape that required to create experimental plot / trial design. It creates experimental plot design to summerize data to geospatially enabled space for next-step mathematical modelling.
🖊️ You can run geoshapes example code on without installing any library in your python environment.
It doesn't requie any dependency to install and you can run all those example from the mybinder.org
📚 Required Library ▶️ Required python library prior to install geoshapes
pip install geoshapes
- geoshapes.splitShape
▶️ Splits geometry▶️ 📓 See Tutorials on splitShape - geoshapes.checkShape
▶️ Check geometry validity - geoshapes.gridShape
▶️ Create grid for geometry▶️ 📓 See Tutorials on gridShape - geoshapes.mergeShape
▶️ Merge splited geometry▶️ 📓 See Tutorials on mergeShape - geoshapes.selectGeom
▶️ Check geometry shapes and store values - geoshapes.utils
▶️ Check geometry type, merge multiple dataframe and delete duplicate geometry
import string, shapely, geoshapes, geopandas
pointLocation = shapely.geometry.Point(0,0)
polygonList = geoshapes.splitShape.splitCircle(
geoms = pointLocation,
circleRadius = 500,
incrementDegree = 45,
clipInterior = True,
innerWidth = 100,
getGeom = 'Both'
)
gdf = geopandas.GeoDataFrame(
geometry = polygonList,
crs = 'EPSG:3857'
)
gdf['ids'] = range(len(gdf))
gdf['Group']= gdf.apply(
lambda row : string.ascii_uppercase[int(row.ids)],
axis = 1)
ax = gdf.plot(figsize=(15, 10),
alpha=0.0, edgecolor='k')
gdf.plot(column='Group',
ax=ax, linewidth=9,
cmap='tab20');
gdf.apply(lambda x: ax.annotate(
text=f"Group : {x.Group}{x.ids}",
xy=x.geometry.centroid.coords[0],
weight='bold', ha='center',
va='center', size=10),axis=1
)
import string, shapely, geoshapes, geopandas
point = shapely.geometry.Point(0,0)
latinShpae = geoshapes.splitShape.splitLatin(point, 25)
featureGeoms = geopandas.GeoDataFrame(
geometry = latinShpae,
crs = 'EPSG:4326'
)
featureGeoms['ids'] = range(len(featureGeoms))
featureGeoms['Group']= featureGeoms.apply(
lambda row : string.ascii_uppercase[int(row.ids)],
axis = 1
)
ax = featureGeoms.plot(
figsize=(15, 10),
alpha=0.4, edgecolor='k')
featureGeoms.plot(
column='Group', ax=ax,
linewidth=9, cmap='tab20'
);
featureGeoms.apply(
lambda x: ax.annotate(
text=f"{x.Group}",
xy=x.geometry.centroid.coords[0],
ha='center',
va='center',
size=20),axis=1
)