Simple site for saving restaurants, using FastAPI, htmx, tinydb and maplibre-gl. based on simplesite for basic structure.
- Store geocod.io API in
.envfile asGEOCODIO_API=$KEY. If not found, will fall back to Nominatim- Run
export (cat .env | xargs -L 1)to export these values to your current shell session.
- Run
- Use
uvand install withuv sync - Then create the css with tailwind:
uv run tailwindcss -i src/restaurant_map/static/src/input.css -o src/restaurant_map/static/css/main.css - Then run the map with
uv run fastapi dev src/restaurant_map/main.py --port 8011, then will be live atlocalhost:8011(or passruninstead fodevfor production)
Always a good idea to run backups. Installing this package will install the restaurant_map script which contains commands to create and restore from backups: backup and restore-backup.
WARNING: restore-backup is a destructive action: the database will be wiped and replaced with the backup.
If you use uv, as above, run this with uv run, e.g., uv run restaurant_map backup backup.json
- add types to tags? type, subtypes, cuisines, details
- then display tags in that order, sorted within each category
- if tag type not specified, consider it a detail
- priority? something to specify places I want to try
- only one type allowed (restaurant, bakery, grocery), but any number for the others
- and then separate color maps within each?
- also add to db:
- visited: date, rating, review, dishes (with four point scale: incredible, good, fine, bad)
- should there be an overall rating? which is just mean of all ratings? or have an option to do something like mean/latest?
- id: hash of coordinates, then use that for selections
- url(s)
- on both view, click on either map or list should jump corresponding pointin other
- list to map: can call map.flyTo with the coordinates directly
- map to list: need to check which view we're in, to determine whether to highlight on list or display popup
- add list sort by distance to click, and just trigger that
- on both view, sort by distance from current location
- ingest geojson:
- don't add duplicate based on coordinates
- add ability to add tag to all imported points
- add ability to do through website?
- color circle based on tag.
- right now just picking a tag, but should pick something reasonable in ontoogy
- add name when zoomed in on all the way
- add toggles for included fields
- filter by tag on map, not just list
- add export to text, with toggles for which fields to include
- export button, one for geojson, one for text, which just exports current view (filtered etc)
- check how exported geojson works with organic maps or osmand
- [-] add create / import backup, to run from command line
- import backup will overwrite everythign
- create backup will include all tables
- then create script that runs create backup regularly, git committing output
- show tags at top of page and filter them by tapping on them
- then ch 4
- add point: with all fields, autocomplete existing tags. add ability to put in either coordinates or address and geocode to other
- import from external map, go right to add point, pre-completing those fields. then test with google maps, organic maps, etc
- add coordinates to add point form, and add geocode/reverse geocode buttons to go back and forth between address and coordinates
- if a point is clicked on the map when add point is clicked, pre-fill those coordinates
- use something similar with add point from geocoder
- not actually adding point to database when hitting submit (getting htmx target error because the corresponding point doesn't exist yet)
- create a dummy entry in database, with hash? in routes.py. but if coordinates is unset or updated after...
- not updating tags correctly when editing tags (getting 405, probably because of same issue as above?)
- when hit cancel on add, should delete temporary entry
- how to create / update dummy entry without coordinates?
- don't let click submit when no title
- add point to map
- bulk delete items
- bulk edit tags: click to select locations and then add/remove tags to all, auto-completing
- list should be easy to filter, sort, and include/exclude various info
- should have "more info" button, which shows everything about current point. same as edit view, but can't edit
- add ability to change sort: distance, date added, name? tags?
- tag view? showing all tags, with number of tagged places, and making ontology clear
- lists: add selected points / tags to list, then have separate ability to just view them
- make website a progressive web
app
with offline support
- offline should be readonly? would it be possible to get it working for other people who won't be connected to my webserver all the time
- I don't think so, because there's so much interaction with web server
- if I wanted to, the proper way to do this with PWA is to use IndexedDB, and this synceddb package looks like a way to sync with remote server via REST API
- but I think instead my preferred thing "fully offline" would be to just export what I want and load into CoMaps
- maplibre use local geojson
- offline should be readonly? would it be possible to get it working for other people who won't be connected to my webserver all the time
- PWA:
- make it able to accept data shared from other apps (ideally, google maps and other maps)
- I think can export to phone using File System API
- and do it regularly with Periodic Background Sync API
- offline maps? using pmtiles? resources
- search on map with geocoder?
- pack it up as docker to run
- geocoding with geopy
- htmx
- tailwindcss docs
- blog with info about self-hosted mapping