###
**Language:** English

2021-11-21, 11:45–12:05 (UTC), Room 2
**Language:**English

osmnx is a python package to that lets you download OpenStreetMap data and gives you the ability to create street networks easily. It automatically creates edges and nodes which are useful when trying to find the shortest route between two places.

In this talk, we'll see how to use it to create a web API service that accepts two points and returns the shortest n number of routes.

We are going to have an overview of the various ways of downloading the data from OpenStreetMap and create network graphs then show how to find nearest n paths using osmnx.

osmnx(https://github.com/gboeing/osmnx) makes it easy to create spatial network graphs from OpenStreetMap data and has a number of functions we can use to download osm data, create network graphs, save network graphs and query the network graphs. It also offers an easy to use API which we're going to have an overview about.

Many people normally use Google Maps API to find the shortest route e.g for delivering goods,shipping applications etc. In this talk, we'll show a free alternative way of finding a number of shortest paths between two coordinates which works for all road networks.(Bikes tracks, foot-paths, highways) and how to filter which street networks you want.

We'll use Cape Town as the area of interest but the technique can be used anywhere OpenStreetMap covers.

We'll first see the various ways of downloading osm data using point buffers and by using bounding boxes, then see how to create network graphs and finally query the graph to find the shortest paths. We're going to use extract shapely linestrings from the graph which we can use to when sending the response on the API.

Finally we'll use fastapi to create one API endpoint which accepts an origin and destination, and returns data as geojson. We're going to use geojson-pydantic to automatically jsonify the linestring.

We'll also show an alternative way of using grpc to transmit geospatial data.