def test_buildings(): gdf = ox.buildings_from_place(place='Piedmont, California, USA') gdf = ox.buildings_from_address(address='San Francisco, California, USA', distance=300) fig, ax = ox.plot_buildings(gdf)
def __init__(self, address='1516 Kenhill Ave, Baltimore, MD', radius=80, same=False): self.address = address self.radius = radius # GEOdataFrame # addr:city # addr:country # addr:housenumber # addr:postcode # addr:state # addr:street # building("yes","no") # amenity, name, religion, denomination # geometry # nodes # < check week6_xx.ipython to get more detail > self.gdf = ox.buildings_from_address(address, distance=radius) # # add new column centroid - the centrel point of house self.gdf = self.gdf.assign(centroid=self.gdf['geometry'].centroid) # initialize the model self.initial_housetype() self.initial_storytype(same=same) # self.Edge = self.GetEdgeSet_OSMNX() self.Houses = self.GetHouseSet_OSMNX() self.Owners = self.GetOwnerSet_OSMNX() self.Renters = self.GetRenterSet_OSMNX() self.Vacants = self.GetVacantSet_OSMNX()
def test_buildings(): # download building footprints and plot them gdf = ox.buildings_from_place(place='Emeryville, California, USA') gdf = ox.buildings_from_address( address='600 Montgomery St, San Francisco, California, USA', distance=300) fig, ax = ox.plot_buildings(gdf)
def test_buildings(): with httmock.HTTMock(get_mock_response_content('overpass-response-1.json.gz')): gdf = ox.buildings_from_place(place='Piedmont, California, USA') with httmock.HTTMock(get_mock_response_content('overpass-response-2.json.gz')): gdf = ox.buildings_from_address(address='260 Stockton Street, San Francisco, California, USA', distance=300) fig, ax = ox.plot_buildings(gdf)
# place_name = "Kamppi, Helsinki, Finland" # Retrieve the data from OSM graph = ox.graph_from_address(place_name) # fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(12,8)) fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(12,8)) fig, ax = ox.plot_graph(graph) # Convert the graph to GeoDataFrames nodes, edges = ox.graph_to_gdfs(graph) # retrieve buildings from OSM buildings = ox.buildings_from_address(place_name, distance=1000) buildings.plot() # footprint of Kamppi footprint = ox.gdf_from_place(place_name) footprint.plot() # Retrieve Points of Interest from OMS restaurants = ox.pois_from_place(place_name, amenities=['restaurant','bar']) restaurants.plot() # Plot all layers together ax = footprint.plot(facecolor='black') ax= edges.plot(ax=ax, linewidth=1, edgecolor='#BC8F8F')
# Specify the name that is used to seach for the data place_name = "Kamppi, Helsinki, Finland" # Fetch OSM street network from the location graph = ox.graph_from_place(place_name) # Fetch OSM street network from the location # graphx = ox.graph_from_place(place_name) graph = ox.graph_from_place(place_name) type(graph) fig, ax = ox.plot_graph(graph) nodes, edges = ox.graph_to_gdfs(graph) buildings = ox.buildings_from_address(place_name, 1000) buildings.plot() footprint = ox.gdf_from_place(place_name) footprint.plot() restaurants= ox.pois_from_place(place_name, amenities=['restaurant']) restaurants.plot() # Plot all layers together ax = footprint.plot(facecolor='black') edges.plot(ax=ax, linewidth=1, edgecolor='#FF0000') #buildings.plot(ax=ax, facecolor='khaki', alpha=0.7) #restaurants.plot(ax=ax, color='green', alpha=0.7, markersize=10) acc.plot(column="nb_pt_r_tt", linewidth=0, legend=True) plt.tight_layout()