consolelog.tools

Geolocation Mock Generator

Generate deterministic, reproducible mock geolocation data and routes for testing. A named seed makes every coordinate and route identical across runs and shareable via URL. Pick a city preset, custom point, or seeded-random location, add seeded jitter or a walking route, then export a browser navigator override, Playwright or Puppeteer test, raw JSON, or GeoJSON.

About this ToolHow it works, benefits & use cases

Mocking the browser Geolocation API by hand is fiddly, and most generators just paste a single hard-coded coordinate. This one is built around a seeded generator: a named seed makes every coordinate, jitter offset, and route point deterministic, so the same seed always produces the exact same output. That means you can commit a fixture, paste a shareable URL into a ticket, or write a test that asserts precise values and get identical results every run. Start from one of 20 real city presets (New York, London, Tokyo, San Francisco, and more), enter custom latitude and longitude, or let the seed scatter a random valid point. Add a seeded jitter radius to wobble the fix realistically, set accuracy, and optionally include altitude, heading, and speed. Switch to route mode to walk a seeded track of N points with a fixed time interval and step distance, complete with a live plotted polyline and a Haversine total-distance readout. Then export to whatever you need: a browser navigator.geolocation override (single fix or stepping watchPosition route), a Playwright test using context.setGeolocation and grantPermissions, a Puppeteer page.setGeolocation script, raw JSON in GeolocationPosition shape, or a GeoJSON Point/LineString. The whole configuration lives in the URL.

How to Use

  1. 1Type a Seed (any text) — it drives every coordinate, so the same seed always yields the same data.
  2. 2Pick a Base location: a city preset, Custom coordinates (enter lat/lng), or Random from the seed.
  3. 3Set Accuracy and an optional Jitter radius in meters, and toggle altitude, heading, or speed if you need them.
  4. 4Switch Mode to Route to build a seeded walking track, then tune the point count, interval, and step distance.
  5. 5Choose an Output target (navigator mock, Playwright, Puppeteer, JSON, or GeoJSON) and copy, download, share, or pipe the result.

Key Benefits

  • Seeded and fully reproducible: the same seed always produces identical coordinates and routes
  • 20 real city presets, custom lat/lng entry, and a seeded-random base point
  • Seeded jitter radius wobbles the fix realistically without losing reproducibility
  • Route mode generates a seeded multi-point track with a live plotted polyline and Haversine distance
  • Five export targets: browser navigator override, Playwright, Puppeteer, JSON, and GeoJSON
  • Optional altitude, heading, and speed on the coords object
  • Shareable URL plus pipe-to support, with a correctly named file per target (geolocation.js, .spec.ts, .geojson, etc.)

Common Use Cases

  • Writing a Playwright or Puppeteer test that needs a stable, asserted geolocation fix
  • Mocking navigator.geolocation in the browser to debug a map or check-in feature
  • Simulating a moving user with a seeded route to test watchPosition handlers
  • Producing a GeoJSON LineString to drop into a map preview or fixture
  • Sharing a reproducible location setup with a teammate via a single URL
Position preview
Latitude
37.7749
Longitude
-122.4194
Accuracy 18.592099m37°46'29.64"N, 122°25'9.84"W
37.774900, -122.419400

Seed consolelog — same seed, same coordinates.

Position

Any text — drives reproducibility

Base: 37.774900, -122.419400

Signal

Copy, download, share, or pipe to another tool

// Mock navigator.geolocation with a fixed position (seed: consolelog)
const mockPosition = {
  coords: {
    latitude: 37.7749,
    longitude: -122.4194,
    accuracy: 18.592099,
    altitude: null,
    altitudeAccuracy: null,
    heading: null,
    speed: null,
  },
  timestamp: Date.now(),
};

navigator.geolocation.getCurrentPosition = function (success) {
  success(mockPosition);
};
navigator.geolocation.watchPosition = function (success) {
  success(mockPosition);
  return 1; // mock watch id
};
navigator.geolocation.clearWatch = function () {};

console.log('Geolocation mocked with:', mockPosition.coords);

Reproducible by design

Unlike most geolocation mockers, this one is built on a seeded generator. The same seed always produces the same coordinates, jitter, and route — so you can commit a fixture, share a URL, or write a test that asserts exact values and get identical output every time. Hit Regenerate for a fresh, equally-stable point.

Single points or full routes

Drop a fixed position with optional seeded jitter, or build a seeded walking route with N points and a fixed time interval. Export a browser navigator.geolocation override, a Playwright or Puppeteer test, raw JSON, or a GeoJSON Point/LineString.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools