These are some examples of using Ipyrest with the OpenStreetMap API.
import geojson
from ipyrest import Api
Api()
Api('https://api.openstreetmap.org/api/capabilities')
Api('https://api.openstreetmap.org/api/0.6/permissions')
Api('https://api.openstreetmap.org/api/0.6/changesets')
https://wiki.openstreetmap.org/wiki/API_v0.6#Map_Notes_API
Ideally, the markers would have the respective notes' text showing in a pop-up, too...
def post(resp):
"Modify response content-type in order to get a GeoJSON view."
resp.headers['Content-Type'] = 'application/vnd.geo+json'
url = 'https://api.openstreetmap.org/api/0.6/notes.json?bbox=-0.65094,51.312159,0.374908,51.669148'
api = Api(url, post_process_resp=post, click_send=True)
api
# list comments
gj = geojson.loads(api.resp.content)
for feat in gj.features:
if feat.geometry.type != 'Point':
continue
lon, lat = feat.geometry.coordinates
print(lat, lon)
# fields inside 'properties' is not standard GeoJSON...
for comment in feat.properties['comments']:
print(comment['text'].strip())
print()