You are given a local JSON file ride-simple.json containing a recorded bike ride as an ordered list of GPS points.
Assume the file format is:
{
"points": [
{"lat": 47.58, "lon": -122.31},
{"lat": 47.581, "lon": -122.309},
...
]
}
You are also given a map-rendering HTTP API. The only allowed endpoint is:
-
POST /render
-
Request: JSON describing the map to render.
-
Response: raw PNG bytes (content-type
image/png
).
Overlay schema (assumed)
Your POST /render JSON may include:
-
center
:
{ "lat": number, "lon": number }
-
width
: integer pixels
-
height
: integer pixels
-
zoom
: integer
-
markers
: array of
{ "lat": number, "lon": number, "type": "start"|"stripe" }
-
paths
: array of
{ "points": [{"lat":..., "lon":...}, ...], "color": "blue"|"brown" }
Tasks
-
Load
ride-simple.json
and extract the ordered coordinate list.
-
Using only
POST /render
, render and save a map image for the following view settings:
{
"center": {"lat": 47.579, "lon": -122.31},
"width": 400,
"height": 600,
"zoom": 13
}
-
Render and save a second map image that includes overlays derived from the ride coordinates:
-
Add a
start
marker at the
first
coordinate.
-
Add a
stripe
marker at the
last
coordinate.
-
Draw the ride polyline by splitting the coordinate list into consecutive chunks of 10 points:
-
Chunk 1 (points 1–10): blue
-
Chunk 2 (points 11–20): brown
-
Chunk 3 (points 21–30): blue
-
... alternating until all points are used.
-
Use the same view settings as in task (2).
Output
-
Two PNG files saved to disk (e.g.,
map_view.png
and
map_ride.png
).
Edge cases to handle
-
Fewer than 2 points in the ride file.
-
Total points not divisible by 10 (final chunk shorter).
-
Network errors or non-200 responses from the render API.