Built a browser-based compass using GPS + DeviceOrientation API — shows where Tokyo landmarks are, and works without installing an app

Enhancing Navigation with a Browser-Based Compass Featuring Tokyo Landmarks

In the realm of mobile web development, leveraging device sensors to create innovative user experiences is an exciting frontier. Recently, I embarked on a project to explore these capabilities by developing a real-time, browser-based compass tailored for Tokyo enthusiasts and travelers. This application demonstrates how modern web APIs can deliver interactive navigation tools without the need for dedicated apps.

Introducing the Tokyo Landmark Compass: A Web-Based Navigation Aid

The Landmark Compass Tokyo is a lightweight, mobile-optimized web application that guides users toward iconic Tokyo landmarks such as Mount Fuji and Tokyo Tower. By harnessing the device’s GPS and orientation sensors, the app provides real-time directional cues, enriching the experience of exploring Tokyo from elevated vantage points or familiar surroundings.

Core Technologies and Implementation Approach

The application is built using standard web technologies, ensuring broad compatibility and easy deployment:

  • HTML and JavaScript: A straightforward, framework-free implementation.
  • Geolocation API: Retrieves the user’s current geographic position.
  • DeviceOrientation API: Accesses the device’s compass heading via window.DeviceOrientationEvent.
  • Haversine Formula: Calculates the bearing from the user’s location to each predefined landmark.

All processing occurs client-side, preserving user privacy by avoiding data transmission to external servers. The list of landmarks and their coordinates can be easily customized within a configuration file (config.js).

Usage Considerations and Limitations

To operate correctly, the application requires:

  • A modern smartphone browser such as Chrome or Safari with support for device sensor APIs.
  • An HTTPS connection, as sensor access mandates secure contexts.
  • Proper permission grants for sensor data access.

Note that it does not function within embedded in-app browsers, such as those within Reddit or Twitter, due to security restrictions on sensor APIs.

Accessing the Tool

Interested users can experience the Landmark Compass Tokyo through the following links:

Future Possibilities

This project exemplifies how accessible web APIs can create engaging, location-aware tools. I invite developers and enthusiasts to customize the application for their own cities or landmarks, fostering a wider adoption of privacy-conscious, sensor-driven web experiences


Leave a Reply

Your email address will not be published. Required fields are marked *