Storing latitude and longitude with fewer than 6 decimal places introduces systematic positional error. At 4 decimal places the precision is approximately 11 meters — enough to place a marker across the street or in an adjacent building. At 2 decimal places it is roughly 1.1 kilometers, which can misplace a marker in the wrong neighborhood entirely. CWE-681 (Incorrect Conversion between Numeric Types) applies when floating-point coordinates are truncated into low-precision columns. ISO 25010:2011 functional-suitability is violated because the directory cannot reliably represent the physical location of a listing. For delivery, navigation, and accessibility use cases, 11-meter error is operationally significant.
Medium because coordinate precision loss silently corrupts marker placement across all listings, undermining the directory's core function without an obvious error signal.
Define latitude and longitude columns with at least 8 decimal places, or use a PostGIS geography type which stores full double-precision coordinates internally.
-- Option 1: explicit decimal columns
ALTER TABLE listings
ADD COLUMN latitude DECIMAL(10, 8),
ADD COLUMN longitude DECIMAL(11, 8);
-- Option 2: PostGIS geography (preferred for spatial queries)
ALTER TABLE listings
ADD COLUMN location GEOGRAPHY(POINT, 4326);
DECIMAL(10, 8) gives 8 decimal places (approximately 1.1mm accuracy). If columns already exist with low precision, migrate the type: ALTER TABLE listings ALTER COLUMN latitude TYPE DECIMAL(10, 8). Verify existing data after migration — low-precision values will not gain precision retroactively and may need re-geocoding.
ID: directory-map-location.geocoding.coordinate-precision
Severity: medium
What to look for: Check the database schema for the latitude and longitude columns. Verify that the precision is at least 6 decimal places (approximately 0.11 meters accuracy). Look for DECIMAL(10, 8) or similar high-precision types, or PostGIS geometry types.
Pass criteria: Latitude and longitude columns are defined with at least 6 decimal places (e.g., DECIMAL(10, 8), DOUBLE PRECISION, or PostGIS geometry). Enumerate all tables that store coordinates and confirm each meets the precision requirement. Coordinates are not stored as text or with truncated precision.
Fail criteria: Coordinates are stored with fewer than 6 decimal places (e.g., DECIMAL(10, 2)), as text, or with precision loss. Map displays inaccurate marker positions.
Skip (N/A) when: No map or coordinate storage exists.
Detail on fail: "Latitude and longitude columns defined as DECIMAL(10, 4); precision is only to ~11 meters, causing marker position inaccuracy" or "Coordinates stored as VARCHAR text without numeric precision"
Remediation: Use high-precision numeric types:
ALTER TABLE listings ADD COLUMN location GEOGRAPHY(POINT, 4326);
ALTER TABLE listings ADD COLUMN latitude DECIMAL(10, 8);
ALTER TABLE listings ADD COLUMN longitude DECIMAL(11, 8);
Example precision levels: