Tutorial: Maps
DUE Wed, 10/8, 2 pm
This tutorial may be completed individually or in teams of at most 2. You can partner differently for each tutorial.
In this tutorial, we’ll add map and location info to Chatter.
Due to location privacy concerns, mada.eecs.umich.edu will not be
available for this tutorial. Continue to treat your messages sent to
chatterd and Ollama as public utterances with no reasonable
expectation of privacy and know that these are recorded and shared
with everyone using chatterd.
Objectives
- Work with on-device streaming data: AsyncStream in Swift, Flow in Kotlin
- Use the location manager
- Access the magnetometer and accelerometer
- Work with Apple MapKit SDK or Google Maps API
- Implement multi-screen navigation
- Implement swipe gesture to transition between screens
APIs and protocol handshakes
To support posting and retrieving geodata information, we add two APIs to Chatter.
These are simply modified postchatt and getchatts APIs that accommodate geodata:
postmaps: uses HTTP POST to post achattwith optionalgeodatainfo as a JSON object, as described below.getmaps: uses HTTP GET to query the database and return all postedchatts, with optionalgeodata, again, as described below.
Using this syntax:
url-endpoint
-> request: data sent to Server
<- response: data sent to Client
The protocol handshakes consist of:
/postmaps
-> HTTP POST { username, message, optional geodata }
<- {} 200 OK
/getmaps
-> HTTP GET {}
<- [ array of chatts with optional geodata ] 200 OK
Modified Chatter API data formats
We define a user’s geodata to comprise of their geolocation
and velocity (facing and speed) at the time of posting a chatt.
As in previous tutorials, the chatts retrieval API sends back all posted chatts in the form
of a JSON Array of string arrays. In addition to “username”, “message”, “id”, and “timestamp” of
the Chatter tutorial, each string array now carries an additional element which is itself an array
of the user’s geodata (in order): latitude (lat), longitue (lon), location (corresponding to the
lat/lon), compass point facing, and speed. If a chatt has no geodata, this
element must have value JSON NULL.
[
["username0", "message0", "id0", "timestamp0", "[lat0, lon0, \"loc0\", \"facing0\", \"speed0\"]"],
["username1", "message1", "id1", "timestamp1", "[lat1, lon1, \"loc1\", \"facing1\", \"speed1\"]"],
...
]
To post a chatt, the client correspondingly sends a JSON object with keys “username”, “message”,
and “geodata”, where the value for key “geodata” conforms to the format above. For example:
{
"username": "YOUR_UNIQNAME",
"message": "Hello world!",
"geodata": "[42.29, -83.72, \"Ann Arbor\", \"South\", \"walking\"]"
}
Notice that both the “facing” and “speed” elements are descriptive, as we’ll explain later.
Specifications
You must first upgrade one of the alternative back-end servers.
then one of the front ends:
| Prepared by Sugih Jamin | Last updated: August 29th, 2025 |