A React Native application designed to test GPS geolocation accuracy against established USGS benchmarks. This single-screen app compares GPS readings against a benchmark location and provides comprehensive statistical analysis of location accuracy.
Built to test GPS accuracy against known surveyed benchmarks from the National Geodetic Survey (NGS). Successfully tested on two benchmarks in Marin County, CA with real-world accuracy validation.
- Single GPS reading: Get one-time location reading
- Continuous tracking: Watch position changes in real-time
- Distance calculation: Haversine formula implementation for precise distance calculations
- Statistical analysis: Real-time statistics including mean, standard deviation, min/max distances
- Cross-platform support: Handles iOS and Android location permissions
- User-friendly interface: Clean, responsive design with coordinate input and real-time display
- Single-file app structure: The entire app logic is contained in
App.tsx - No navigation library: Single screen application with all functionality on one view
- State management: Uses React hooks (useState, useEffect) for local state management
- No external API dependencies: All processing is done client-side
@react-native-community/geolocation: Core geolocation functionalityreact-native-permissions: Handles location permission requests across platformsreact-native-safe-area-context: Safe area handling for different device types
- Languages: JavaScript/TypeScript, JSX
- Framework: React Native with CLI (not Expo - chosen for full native access to precise GPS APIs)
- Native APIs: iOS Location Services, Core Location
- Tools: Xcode, Metro, npm, CocoaPods
- Libraries:
@react-native-community/geolocation - Platforms: iOS development and deployment (Android ready)
Note: Make sure you have completed the React Native Environment Setup guide before proceeding.
- Node.js >= 18
- React Native CLI
- iOS: Xcode and CocoaPods
- Android: Android Studio and SDK
- Clone the repository
git clone <repository-url>
cd react-native-geolocation-tester- Install dependencies
npm install- iOS setup (required on first clone or after native dependency changes)
bundle install
bundle exec pod install- Start Metro bundler
npm start- Run on your target platform
npm run ios
# OR for device deployment
npx react-native run-ios --devicenpm run androidIf everything is set up correctly, you should see the GPS Accuracy Checker running on your device or simulator.
# Run linting
npm run lint
# Run tests
npm test- Set Benchmark Coordinates: Enter the latitude and longitude of your known benchmark location
- Choose Reading Mode:
- Single Reading: Get one GPS reading to test accuracy
- Continuous Tracking: Start real-time tracking for statistical analysis
- View Results: See distance from benchmark, GPS accuracy, and statistical analysis
- Analyze Data: Review recent readings and comprehensive statistics
The benchmark coordinates can be set in the app interface or modified in App.tsx:
const [benchmarkLat, setBenchmarkLat] = useState('37.936722');
const [benchmarkLon, setBenchmarkLon] = useState('-122.534278');The app uses high-accuracy GPS settings:
enableHighAccuracy: truetimeout: 15000msmaximumAge: 0(no cached readings)distanceFilter: 0(get all position updates)
The app implements a comprehensive GPS accuracy testing framework:
- Distance Calculation: Uses the Haversine formula to calculate precise distances between GPS readings and the benchmark location
- Statistical Analysis: Provides real-time statistics including mean, standard deviation, min/max distances
- Accuracy Tracking: Records both the GPS-reported accuracy and actual distance from known location
- Historical Data: Maintains reading history with timestamps for analysis
- Project Setup: CLI vs Expo trade-offs for native API access
- State Management: React hooks for location data and UI state
- Native Integration: iOS/Android permission handling differences
- Performance: Location tracking cleanup and battery considerations
- Permissions: Platform-specific location permission requirements
- Real Device Testing: GPS functionality requires physical devices
- User Experience: Input validation, error handling, responsive design
- Performance: Proper cleanup of location watchers
- Haversine Formula: Great-circle distance calculations
- Statistical Analysis: Real-time computation of accuracy metrics
- Coordinate Systems: DMS to decimal degree conversion support
If location readings fail, check that:
- Location permissions are granted in device settings
- Location services are enabled on the device/emulator
- The app has been granted "precise location" access (iOS 14+)
- Clear Metro cache:
npx react-native start --reset-cache - Clean build: Delete
node_modulesand runnpm install - iOS: Clean Xcode build folder and re-run
bundle exec pod install
- Permission errors: Handling location access denied scenarios
- GPS errors: Timeout, accuracy, and availability issues
- Certificate/signing issues: Resolving Xcode keychain and provisioning problems
- Metro bundler troubleshooting: Understanding when to restart vs reload
β
Functional app deployed to physical iPhone
β
Real-world validation tested against two NGS benchmarks
β
Accurate measurements confirmed GPS readings vs survey data
β
User-friendly interface with coordinate input and real-time display
β
Professional development workflow established
- Android deployment: Extend to Android platform
- Maps integration: Add visual maps showing GPS readings
- Data persistence: Save readings to device storage
- Bluetooth/external GPS: Connect to external GPS receivers
- Background processing: Continue tracking when app backgrounded
- UI polish: Custom icons, animations, better styling
- Testing: Unit tests, integration tests for location functionality
- V2: Integrate with NGS API to get benchmark data and allow user to enter benchmark number and receive information
- V3: Integrate with NGS API to create a map of the area and allow user to find benchmarks and test accuracy
To learn more about React Native and GPS development:
- React Native Website - learn more about React Native
- React Native Geolocation - GPS API documentation
- National Geodetic Survey - Find survey benchmarks for testing
- Haversine Formula - Distance calculation methodology
This project is built with React Native using @react-native-community/cli.