get_area_url(location,
distance)
|
|
Generate URL for downloading OSM data within a region
This function defines a boundary box where the edges touch a circle of
distance kilometres in radius. It is important to note that the box is
neither a square, nor bounded within the circle.
The bounding box is strictly a trapezoid whose north and south edges are
different lengths, which is longer is dependant on whether the box is
calculated for a location in the Northern or Southern hemisphere. You will
get a shorter north edge in the Northern hemisphere, and vice versa. This
is simply because we are applying a flat transformation to a spherical
object, however for all general cases the difference will be negligible.
>>> get_area_url(point.Point(52.015, -0.221), 3)
'http://api.openstreetmap.org/api/0.5/map?bbox=-0.264864438253,51.9880034021,-0.177135561747,52.0419965979'
>>> get_area_url(point.Point(52.015, -0.221), 12)
'http://api.openstreetmap.org/api/0.5/map?bbox=-0.396457433591,51.9070136086,-0.045542566409,52.1229863914'
- Parameters:
location (Point-like object) - Centre of the region
distance (int ) - Boundary distance in kilometres
- Returns:
str
- URL that can be used to fetch the OSM data within
distance of
location
|