I've a point geodataframe which has only point features inside of it.
fishnet_Id ... geometry
0 0 ... POINT (403486 4540640)
1 0 ... POINT (403736 4540640)
I want to create a bounding box polygon feature from the easternmost, southernmost, northernmost and westernmost point and then pass it into osmnx.gdf_from_bbox method.
I could do it via finding the biggest/smallest lat and biggest/smallest lon values and then make a column from these values and pass these values into the osmnx function manually but I want to do it more code-efficient way.
(Right now its look like this)
import geopandas as gpd
import pandas as pd
import osmnx as ox
from fiona.crs import from_epsg
origins = gpd.read_file(r"data\Origin_Clip.shp")
destinations = gpd.read_file(r"data\Dest_Clip.shp")
origins["geometry"] = origins["geometry"].to_crs(epsg=4326)
destinations["geometry"] = destinations["geometry"].to_crs(epsg=4326)
origins["lat"] = origins["geometry"].x
origins["lon"] = origins["geometry"].y
destinations["lat"] = destinations["geometry"].x
destinations["lon"] = destinations["geometry"].y
points = gpd.GeoDataFrame(pd.concat([origins, destinations], ignore_index=True))
xmin, xmax = points["lat"].min(), points["lat"].max()
ymin, ymax = points["lon"].min(), points["lon"].max()
G = ox.graph_from_bbox(ymax, ymin, xmax, xmin, clean_periphery=False)