CC-BY-SA 4.0
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.7.5 (21114 thorn-02.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<way id="308668766" visible="true" version="14" changeset="72300285" timestamp="2019-07-16T11:27:32Z" user="Michael008" uid="7666560">
........
<tag k="addr:city" v="Accra"/>
<tag k="amenity" v="university"/>
<tag k="contact:twitter" v="https://twitter.com/UnivofGhana"/>
<tag k="contact:website" v="http://ug.edu.gh/"/>
<tag k="description" v="University of Ghana is the first and largest universitiy and tertiary institution in Ghana."/>
<tag k="name" v="University of Ghana"/>
<tag k="opening_hours" v="24/7"/>
<tag k="operator:type" v="public"/>
<tag k="project:oif-dfen_carteinnov" v="yes"/>
<tag k="short_name" v="UG, Legon"/>
<tag k="source" v="local_knowledge;oif-dfen_carteinnov"/>
<tag k="source:geometry" v="Bing"/>
<tag k="start_date" v="1948"/>
<tag k="wikidata" v="Q2303765"/>
<tag k="wikipedia" v="en:University of Ghana"/>
</way>
</osm>
import requests
overpass_url = "http://overpass-api.de/api/interpreter"
overpass_query = """
[out:json];
area["ISO3166-1"="GH"][admin_level=2];
(
node["amenity"="school"](area);
);
out count;"""
response = requests.get(overpass_url, params={'data': overpass_query})
response.json()
{'version': 0.6, 'generator': 'Overpass API 0.7.55.7 8b86ff77', 'osm3s': {'timestamp_osm_base': '2019-08-09T01:39:03Z', 'timestamp_areas_base': '2019-08-09T00:37:02Z', 'copyright': 'The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.'}, 'elements': [{'type': 'count', 'id': 0, 'tags': {'nodes': '1425', 'ways': '0', 'relations': '0', 'areas': '0', 'total': '1425'}}]}
import osmnx as ox
import matplotlib.pyplot as plt
%matplotlib inline
# Specify the name that is used to seach for the data
place_name = "University of Ghana, Accra, Ghana"
# Fetch OSM street network from the location
graph = ox.graph_from_place(place_name)
type(graph)
# Plot the streets
fig, ax = ox.plot_graph(graph)
Tweet by @klaskarlsson