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 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)
# MASH # Analysis of Bioko Island Geographical Data # Sean Wu # July 19, 2017 # #============================================================================== import osmnx as ox from IPython.display import Image %matplotlib inline # import all movement paths biokoGraph = ox.graph_from_place('Bioko', network_type='all') ox.plot_graph(biokoGraph,fig_height=20) # import buildings & save to .shp biokoBldg = ox.buildings_from_place('Bioko') biokoBldgProj = ox.project_gdf(biokoBldg) ox.plot_buildings(gdf=biokoBldgProj,bgcolor='#333333',color='w',save=True, show=False, close=True, filename='biokoBldg', dpi=90) Image('{}/{}.{}'.format('images', 'biokoBldg', 'png'), height=800, width=800) biokoBldgShp = biokoBldg.drop(labels='nodes',axis=1) biokoBldgShp.to_file('Desktop/BiokoBldg') biokoAreas = biokoBldgProj.area # basic analysis of road network biokoGraphLength = ox.get_edge_colors_by_attr(biokoGraph, attr='length') ox.plot_graph(biokoGraph, edge_color=biokoGraphLength,fig_height=30) # helper funcion to get one-square-mile street networks, building footprints, and plot them
import geopandas as gpd import pandas as pd import numpy as np import matplotlib.pyplot as plt import osmnx as ox place_name = "Kamppi, Helsinki, Finland" graph = ox.graph_from_place(place_name) fig, ax = ox.plot_graph(graph) plt.tight_layout() area = ox.gdf_from_place(place_name) buildings = ox.buildings_from_place(place_name) nodes, edges = ox.graph_to_gdfs(graph) import re string = "" x = re.findall("ai", string) import requests import json overpass_url = "http://overpass-api.de/api/interpreter" overpass_query = """ [out:json]; area["ISO3166-1"="DE"][admin_level=2]; (node["amenity"="biergarten"](area); way["amenity"="biergarten"](area); rel["amenity"="biergarten"](area); ); out center; """ response = requests.get(overpass_url, params={'data': overpass_query}) data = response.json()