c136cee04f6a8defd132592820cdbf9dccd13e01
- controller: @Query() params arrive as strings in NestJS - now explicitly
parseFloat() all numeric params (lat, lng, radius) before passing to service.
Also validates against NaN before hitting PostGIS.
- controller: reverse geocode now validates and throws 400 on invalid lat/lng.
- service: searchPlaces now normalizes all results to include:
- location: { lat, lng } nested object (frontend was crashing on place.location.lat)
- distance_km: pre-computed string field (frontend was reading undefined distance_km)
- latitude/longitude as actual floats (not decimal strings from DB)
- frontend (App.tsx): fixed map.flyTo() to read place.latitude/place.longitude
instead of the non-existent place.location.lat/lng.
- frontend (App.tsx): fixed search result click handler same way.
- frontend (App.tsx): fixed distance display to compute from res.distance (meters).
- entity: added missing source column to BasePlace entity.
Jordan Map SaaS Platform 🗺️
منصة خرائط الأردن البرمجية
A complete self-hosted mapping platform prototype for Jordan, built with OpenStreetMap, GraphHopper, and NestJS.
🚀 Quick Start / البدء السريع
- Clone the repository
- Run the setup script to download Jordan OSM data:
npm run setup - Perform one-time OSM import into PostGIS:
docker-compose --profile import up osm-import - Start the platform:
docker-compose up --build
🏗️ Architecture / المعمارية البرمجية
- Backend: NestJS (API Gateway, Telemetry Ingestion, Routing Proxy)
- Frontend: React + MapLibre GL JS (Interactive Map Dashboard)
- Database: PostgreSQL + PostGIS (Spatial persistence)
- Routing: GraphHopper (Java-based OSM routing engine)
- Cache: Redis (Hot driver positions and API caching)
- Tile Server: Tileserver-GL (Serving Jordan vector/raster tiles)
📡 Key API Endpoints / أهم الروابط البرمجية
| Endpoint | Method | Description |
|---|---|---|
/api |
GET | Swagger Documentation |
/maps/config |
GET | Map center and region bounds |
/maps/route |
GET | Routing between two points |
/telemetry |
POST | Ingest driver location (every 3s) |
/telemetry/nearby |
GET | Find drivers within a radius |
🛠️ Tech Stack / التقنيات المستخدمة
- Node.js v18
- PostGIS 15
- GraphHopper Latest
- MapLibre GL JS
📝 Arabic Comments / ملاحظات باللغة العربية
تم تصميم هذا النظام ليكون نواة لمنصة خرائط تجارية تدعم تطبيقات التوصيل والنقل الذكي في الأردن، مع التركيز على استيعاب بيانات الموقع اللحظية للسائقين كل 3 ثواني ومعالجتها مكانياً.
⚠️ Limitations / القيود الحالية
- Does not include full Map Matching for traffic light delay logic (Phase 2).
- Requires manual download of MBTiles for high-performance tile serving in production.
Languages
JavaScript
45.9%
TypeScript
28.4%
HTML
12.5%
Dart
6.1%
Shell
3.8%
Other
3.3%