feat: (broken) implement route map and address autocomplete widgets with associated infrastructure testing scripts

This commit is contained in:
ElPoyo
2026-06-05 11:10:32 +02:00
parent 8c01a21728
commit 21d7bc8b87
40 changed files with 21078 additions and 30 deletions
+21
View File
@@ -0,0 +1,21 @@
const axios = require('axios');
require('dotenv').config({ path: '.env' });
async function testSteps() {
const apiKey = process.env.API_MAPS;
const resToll = await axios.post('https://routes.googleapis.com/directions/v2:computeRoutes', {
travelMode: 'DRIVE', routingPreference: 'TRAFFIC_UNAWARE',
origin: { address: "25 Impasse du Puits du Suc, Saint-Martin-en-Haut, France" },
destination: { address: "Toulouse, France" },
}, { headers: { 'Content-Type': 'application/json', 'X-Goog-Api-Key': apiKey, 'X-Goog-FieldMask': 'routes.legs.steps.navigationInstruction,routes.legs.steps.distanceMeters,routes.legs.steps.startLocation,routes.legs.steps.endLocation' } });
const steps = resToll.data.routes[0].legs[0].steps;
for(let i=0; i<steps.length; i++) {
const step = steps[i];
const inst = step.navigationInstruction ? step.navigationInstruction.instructions : '';
if(inst.toLowerCase().includes('péage') || inst.toLowerCase().includes('toll')) {
console.log(`Step ${i}: ${inst} (Dist: ${step.distanceMeters}m)`);
}
}
}
testSteps();