Path: blob/main/tests/snapshots/modules/issue_2109.py
1602 views
import geopandas as gpd1import pandas as pd23import folium45data = {6"warehouses": {71: ("Allentown", "Allentown", "PA", "18101", 40.602812, -75.470433),82: ("Atlanta", "Atlanta", "GA", "30301", 33.753693, -84.389544),93: ("Baltimore", "Baltimore", "MD", "21201", 39.294398, -76.622747),104: ("Boston", "Boston", "MA", "02101", 42.36097, -71.05344),115: ("Chicago", "Chicago", "IL", "60602", 41.88331, -87.624713),12},13"customers": {141: ("Akron", "Akron", "OH", " ", 41.08, -81.52),152: ("Albuquerque", "Albuquerque", "NM", " ", 35.12, -106.62),163: ("Alexandria", "Alexandria", "VA", " ", 38.82, -77.09),174: ("Amarillo", "Amarillo", "TX", " ", 35.2, -101.82),185: ("Anaheim", "Anaheim", "CA", " ", 33.84, -117.87),196: ("Brownfield", "Brownfield", "TX", " ", 33.18101, -102.27066),207: ("Arlington", "Arlington", "TX", " ", 32.69, -97.13),218: ("Arlington", "Arlington", "VA", " ", 38.88, -77.1),229: ("Atlanta", "Atlanta", "GA", " ", 33.76, -84.42),2310: ("Augusta-Richmond", "Augusta-Richmond", "GA", " ", 33.46, -81.99),24},25}2627df_customer = pd.DataFrame(28list(data["customers"].values()),29columns=["Facility Name", "City", "State", "Zip", "Latitude", "Longitude"],30)31df_customer["Facility Name"] = (32"CUST_" + df_customer["Facility Name"] + "_" + df_customer["State"]33)3435df_customer_geometry = gpd.points_from_xy(df_customer.Longitude, df_customer.Latitude)36gdf_customer = gpd.GeoDataFrame(37df_customer, crs="EPSG:4326", geometry=df_customer_geometry38)39gdf_customer["Facility Type"] = "Customer"4041df_warehouse = pd.DataFrame(42list(data["warehouses"].values()),43columns=["Facility Name", "City", "State", "Zip", "Latitude", "Longitude"],44)45df_warehouse["Facility Name"] = (46"WH_" + df_warehouse["Facility Name"] + "_" + df_customer["State"]47)4849df_warehouse_geometry = gpd.points_from_xy(50df_warehouse.Longitude, df_warehouse.Latitude51)52gdf_warehouse = gpd.GeoDataFrame(53df_warehouse, crs="EPSG:4326", geometry=df_warehouse_geometry54)55gdf_warehouse["Facility Type"] = "Warehouse"5657m = folium.Map([40, -100.0], zoom_start=5, tiles=None)5859gdf_warehouse.explore(60m=m,61marker_type="marker",62marker_kwds=dict(icon=folium.Icon(color="red", icon="warehouse", prefix="fa")),63name="Warehouse",64)6566gdf_customer.explore(67m=m,68marker_type="marker",69marker_kwds=dict(icon=folium.Icon(color="green", icon="tent", prefix="fa")),70name="Customers",71)7273folium.LayerControl().add_to(m)747576