fix(elevation): Restore smooth non-zero continuous terrain differentials

This commit is contained in:
Hamza-Ayed
2026-08-21 02:49:41 +03:00
parent 8a0cf35116
commit 96b22d1fc0
+15 -12
View File
@@ -608,8 +608,8 @@ export class MapsService {
} }
/** /**
* High-Precision Multi-Scale Topographic Elevation Model for Jordan * High-Precision Topographic Elevation Model for Jordan
* Combines regional DEM baseline with realistic wadi systems, ridge crests, and urban hill models (Amman 7 hills, Zarqa Basin & North). * Continuous multi-scale terrain incorporating valley relief, ridge crests, and natural drainage slopes.
*/ */
private estimateElevation(lat: number, lng: number): number { private estimateElevation(lat: number, lng: number): number {
// 1. Regional Base Elevation Surface (Western Rift to Eastern Desert) // 1. Regional Base Elevation Surface (Western Rift to Eastern Desert)
@@ -631,17 +631,20 @@ export class MapsService {
} }
// Central Urban Basin (East Amman, Zarqa, Rusaifa, Madaba, Irbid Plateau) // Central Urban Basin (East Amman, Zarqa, Rusaifa, Madaba, Irbid Plateau)
else if (lng >= 35.88 && lng < 36.25) { else if (lng >= 35.88 && lng < 36.25) {
if (lat >= 32.4) { if (lat >= 32.35) {
baseElev = 580 + (lat - 32.4) * 80; // Irbid Plateau (580m - 620m) baseElev = 580 + (lat - 32.35) * 80; // Irbid Plateau
} else if (lat >= 32.0 && lat < 32.25) { } else if (lat >= 32.0 && lat < 32.35) {
// Zarqa & Sukhna River Basin (520m in river bed, 680m on surrounding hills) // Zarqa & Sukhna Basin Topography (Parabolic valley profile with natural drainage)
const riverAxisLat = 32.06 + (lng - 36.05) * 0.7; // Zarqa river path const riverAxisLat = 32.06 + (lng - 36.05) * 0.65;
const distFromRiver = Math.abs(lat - riverAxisLat) * 111.32; // km from river const distFromRiverKm = Math.abs(lat - riverAxisLat) * 111.32;
const localWadiRelief = Math.min(140, distFromRiver * 70); // 0m in wadi, +140m on hill crests // Parabolic rise from riverbed (530m) up to surrounding hills (660m)
baseElev = 530 + localWadiRelief + (lng - 36.0) * 45; const valleyRelief = 120 * (1 - Math.exp(-Math.pow(distFromRiverKm / 1.5, 2)));
const longitudinalSlope = (32.15 - lat) * 60; // Slopes downwards northwards
const localHillWave = Math.sin(lat * 80.0) * 18.0 + Math.cos(lng * 90.0) * 14.0;
baseElev = 540 + valleyRelief + longitudinalSlope + localHillWave;
} else if (lat >= 31.85 && lat < 32.0) { } else if (lat >= 31.85 && lat < 32.0) {
// Amman 7 Hills & Valleys Topography // Amman 7 Hills & Valleys Topography
const localAmmanHill = Math.sin((lat - 31.95) * 180) * 70 + Math.cos((lng - 35.92) * 180) * 60; const localAmmanHill = Math.sin((lat - 31.95) * 120) * 45 + Math.cos((lng - 35.92) * 120) * 40;
baseElev = 840 - (lng - 35.90) * 350 + localAmmanHill; baseElev = 840 - (lng - 35.90) * 350 + localAmmanHill;
} else if (lat < 31.85 && lat >= 31.6) { } else if (lat < 31.85 && lat >= 31.6) {
baseElev = 740 + (lat - 31.6) * 100; // Airport / Madaba plains baseElev = 740 + (lat - 31.6) * 100; // Airport / Madaba plains
@@ -654,7 +657,7 @@ export class MapsService {
baseElev = 640 + (lng - 36.25) * 20 - (lat - 32.0) * 30; baseElev = 640 + (lng - 36.25) * 20 - (lat - 32.0) * 30;
} }
return Math.round(baseElev); return baseElev;
} }
private haversineDistance(lat1: number, lon1: number, lat2: number, lon2: number): number { private haversineDistance(lat1: number, lon1: number, lat2: number, lon2: number): number {