Maps
Place search and map tiles from OpenStreetMap or Google, and what each one's terms ask of the app.
src/maps/ gives events and tasks a place: a search that answers as you type, and a map whose pin can be put anywhere.
| File | What it holds |
|---|---|
mod.rs | the shared USER_AGENT and the Source in use |
osm.rs | place search on Photon, and the address at a spot |
google.rs | the same through Google, for people who bring their own API key |
tiles.rs | map tiles from OpenStreetMap or Google, and the tile cache |
widget.rs | a map that can be dragged and zoomed, with a pin |
picker.rs | the dialog that finds a place |
The place itself is Place in src/model/place.rs: the words people read, and the spot on a map when one is known.
OpenStreetMap#
The default. It needs no key.
- Search goes to Photon at
https://photon.komoot.io, or to the person's own Photon server (Settings › Maps). One question is asked at a time, on a worker thread, once typing has paused. Every answer is kept in memory, so going back to an earlier word asks nothing. - Tiles come from OpenStreetMap. Each tile is fetched the first time it is shown. It is kept on disk in a
tilesfolder besidedata.json, for as long as the server'sCache-ControlorExpiressays, or a week when it says nothing. That is what the OSM tile policy asks.
Every request sends this user agent, which the OSM policies ask for:
katlendar/<version> (+https://github.com/kud3n013/katlendar)
Google#
Only for people who give the app a Google Maps API key of their own. Katlendar ships no key.
- Search uses Places Autocomplete (New) and Place Details (New). The address at a spot uses the Geocoding API. Tiles come from the Map Tiles API.
- The key is kept in the keyring as
maps:google. It is added to a request only as it is sent.
Google's terms ask for these, and the code keeps to them. Don't change them without reading the terms again:
- A search and the details of the place it ends in share one session token. A new one is made after each pick.
- A place's ID may be kept for good.
- The latitude and longitude Google gives may be kept for 30 days at most.
Place::expirelets them go after that. They are never written to a calendar server. - Tiles are kept in memory only, never on disk.
- "Google Maps" and the map data's copyright are shown under the map.
Checks against the real services#
The fixtures in src/sync/fixtures/ are modelled on what each service sends, not captured from real accounts. To learn what a server really keeps of a place, run the live checks (see Testing). The app repo's docs/map-checks.md holds the checklist and the results so far.