Python Challenge 4 Hints and Tips

Hints for Python Challenge 4

Packages

  • In this challenge there are likely to be a large number of ways of achieving the outcome. The json and requests packages are used for calling and retrieving the API calls in the solution we have developed.
  • The API used for calling OpenStreetMap is called overpass. There is an interactive online version for quickly testing commands called overpass turbo that may be useful.

Hints

  • It will likely be quite difficult to complete this challenge without using the online docu­mentation for both the API and OpenStreetMap itself to understand how they construct the map.
  • Latitude and longitude are not the same as co-ordinates in the plane, and so we can’t directly use these to find distances on a map using the pythagorean formula √(x2+y2). What can we use instead?
  • The area type cannot be nested natively. Using the map to area command might help to identify subregions.

Notes

  • One of the challenges with this task is that the length and number of API calls must be kept small. Inefficient calls to the API can cause the code to become very slow, so try different options.
  • Note that servers called by the API can sometimes be busy. The HTTP return code can be used to identify the reason for the call failing.

Solution for Python Challenge 4