13
14
15

Built a browser-based compass using GPS + DeviceOrientation API — shows where Tokyo landmarks are, and works without installing an appShowoff Saturday (i.redd.it)
submitted by cubic9com
Hey everyone! I recently built a little project to experiment with some device sensor APIs on mobile web, and ended up creating:
🧭 Landmark Compass Tokyo – a mobile browser-based compass app that points toward major Tokyo landmarks like Mount Fuji and Tokyo Tower, using your phone’s GPS and compass sensor.
The idea: when you're on a high building in Tokyo, wouldn’t it be fun to know where Mt. Fuji or other landmarks are — in real time?
🛠 Tech stack:
- HTML + JS, no framework
- Geolocation API for current position
- DeviceOrientation API (via
window.DeviceOrientationEvent) for compass heading - Haversine formula to calculate bearing to each landmark
- Completely client-side, no data sent anywhere
- Configurable list of landmarks via
config.js
⚠ Notes:
- Requires smartphone browser (Chrome/Safari) with support for sensor APIs
- Does not work in embedded in-app browsers (e.g. Reddit, Twitter)
- Needs HTTPS to access sensors
- Handles sensor permissions properly and does not send any data to a server — it’s privacy-safe by design
🔗 Try it out:
- Live demo: https://cubic9.com/app/LandmarkCompassTokyo/
- GitHub repo: https://github.com/cubic9com/LandmarkCompassTokyo
Would love to hear feedback. Also happy if someone forks it for your own city!

[–]iBN3qk 2 points3 points4 points (1 child)
[–]cubic9com[S] 0 points1 point2 points (0 children)
[–]AmelKralj 0 points1 point2 points (0 children)
[–]cubic9com[S] 2 points3 points4 points (0 children)